Overview
Comment: | Remove memory pool |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
0097baa3a78b36f6358e9877ad0c14ed |
User & Date: | js on 2025-03-08 01:09:36 |
Other Links: | manifest | tags |
Context
2025-03-08
| ||
02:38 | Improve clang-format check-in: 6f5dd50626 user: js tags: trunk | |
01:09 | Remove memory pool check-in: 0097baa3a7 user: js tags: trunk | |
00:58 | More string migration check-in: 245efe8045 user: js tags: trunk | |
Changes
Modified src/clientgame.mm from [ce2ec26dd6] to [2ddec801b6].
︙ | ︙ | |||
96 97 98 99 100 101 102 | d->ammo[GUN_SG] = 5; }; }; dynent * newdynent() // create a new blank player or monster { | | | 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | d->ammo[GUN_SG] = 5; }; }; dynent * newdynent() // create a new blank player or monster { dynent *d = (dynent *)malloc(sizeof(dynent)); d->o.x = 0; d->o.y = 0; d->o.z = 0; d->yaw = 270; d->pitch = 0; d->roll = 0; d->maxspeed = 22; |
︙ | ︙ | |||
182 183 184 185 186 187 188 | }; }; void zapdynent(dynent *&d) { if (d) | | | 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | }; }; void zapdynent(dynent *&d) { if (d) free(d); d = NULL; }; extern int democlientnum; void otherplayers() |
︙ | ︙ |
Modified src/commands.mm from [ac6583caf8] to [2917ffb85d].
︙ | ︙ | |||
15 16 17 18 19 20 21 | { sprintf_s(s)("%d", i); } char * exchangestr(char *o, const char *n) { | | | | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | { sprintf_s(s)("%d", i); } char * exchangestr(char *o, const char *n) { free(o); return strdup(n); } // contains ALL vars/commands/aliases static OFMutableDictionary<OFString *, __kindof Identifier *> *identifiers; void alias(OFString *name, OFString *action) |
︙ | ︙ | |||
128 129 130 131 132 133 134 | brak--; else if (!c) { p--; conoutf(@"missing \"%c\"", right); return NULL; } } | | | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | brak--; else if (!c) { p--; conoutf(@"missing \"%c\"", right); return NULL; } } char *s = strndup(word, p - word - 1); if (left == '(') { string t; // evaluate () exps directly, and substitute result @autoreleasepool { itoa(t, execute(@(s))); } s = exchangestr(s, t); |
︙ | ︙ | |||
150 151 152 153 154 155 156 | p += strspn(p, " \t\r"); if (p[0] == '/' && p[1] == '/') p += strcspn(p, "\n\0"); if (*p == '\"') { p++; char *word = p; p += strcspn(p, "\"\r\n\0"); | | | | 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | p += strspn(p, " \t\r"); if (p[0] == '/' && p[1] == '/') p += strcspn(p, "\n\0"); if (*p == '\"') { p++; char *word = p; p += strcspn(p, "\"\r\n\0"); char *s = strndup(word, p - word); if (*p == '\"') p++; return s; } if (*p == '(') return parseexp(p, ')'); if (*p == '[') return parseexp(p, ']'); char *word = p; p += strcspn(p, "; \t\r\n\0"); if (p - word == 0) return NULL; return strndup(word, p - word); } OFString * lookup(OFString *n) // find value of ident referenced with $ in exp { @autoreleasepool { __kindof Identifier *identifier = |
︙ | ︙ |
Modified src/console.mm from [2969d1193c] to [de4b6af5c1].
︙ | ︙ | |||
28 29 30 31 32 33 34 | } COMMANDN(conskip, setconskip, ARG_1INT) static void conline(OFString *sf, bool highlight) // add a line to the console buffer { cline cl; | > | > | < | | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | } COMMANDN(conskip, setconskip, ARG_1INT) static void conline(OFString *sf, bool highlight) // add a line to the console buffer { cline cl; // constrain the buffer size cl.cref = conlines.length() > 100 ? conlines.pop().cref : (char *)calloc(_MAXDEFSTR, 1); // for how long to keep line on screen cl.outtime = lastmillis; conlines.insert(0, cl); if (highlight) // show line in a different colour, for chat etc. { cl.cref[0] = '\f'; cl.cref[1] = 0; strcat_s(cl.cref, sf.UTF8String); } else { |
︙ | ︙ |
Modified src/monster.mm from [34205145ec] to [6306bf3f2c].
︙ | ︙ | |||
98 99 100 101 102 103 104 | basicmonster(type, rnd(360), M_SEARCH, 1000, 1); }; void monsterclear() // called after map start of when toggling edit mode to // reset/spawn all monsters to initial state { | | | 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | basicmonster(type, rnd(360), M_SEARCH, 1000, 1); }; void monsterclear() // called after map start of when toggling edit mode to // reset/spawn all monsters to initial state { loopv(monsters) free(monsters[i]); monsters.setsize(0); numkilled = 0; monstertotal = 0; spawnremain = 0; if (m_dmsp) { nextmonster = mtimestart = lastmillis + 10000; monstertotal = spawnremain = gamemode < 0 ? skill * 10 : 0; |
︙ | ︙ |
Modified src/tools.h from [217eb7d86e] to [a99286d792].
︙ | ︙ | |||
115 116 117 118 119 120 121 | } #define sprintf_sdv(d, fmt) sprintf_sdlv(d, fmt, fmt) #define fast_f2nat(val) ((int)(val)) extern void endianswap(void *, int, int); | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | | 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | } #define sprintf_sdv(d, fmt) sprintf_sdlv(d, fmt, fmt) #define fast_f2nat(val) ((int)(val)) extern void endianswap(void *, int, int); template <class T> struct vector { T *buf; int alen; int ulen; vector() { alen = 8; buf = (T *)malloc(alen * sizeof(T)); ulen = 0; } ~vector() { setsize(0); free(buf); } vector(vector<T> &v); void operator=(vector<T> &v); T & add(const T &x) |
︙ | ︙ | |||
267 268 269 270 271 272 273 | qsort(buf, ulen, sizeof(T), (int(__cdecl *)(const void *, const void *))cf); } void realloc() { | < < | | 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | qsort(buf, ulen, sizeof(T), (int(__cdecl *)(const void *, const void *))cf); } void realloc() { buf = (T *)::realloc(buf, (alen *= 2) * sizeof(T)); } T remove(int i) { T e = buf[i]; for (int p = i + 1; p < ulen; p++) |
︙ | ︙ | |||
302 303 304 305 306 307 308 | } else \ for (int i = 0; i < (v).length(); i++) #define loopvrev(v) \ if (false) { \ } else \ for (int i = (v).length() - 1; i >= 0; i--) | < < < < < < < < < < < < < < < < < < | 241 242 243 244 245 246 247 248 | } else \ for (int i = 0; i < (v).length(); i++) #define loopvrev(v) \ if (false) { \ } else \ for (int i = (v).length() - 1; i >= 0; i--) #endif |
Modified src/tools.mm from [06a94d32b1] to [d7e6269b15].
1 2 3 4 5 | // implementation of generic tools #include "tools.h" #include <new> | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 | // implementation of generic tools #include "tools.h" #include <new> ///////////////////////// misc tools /////////////////////// void endianswap( void *memory, int stride, int length) // little indians as storage format { if (*((char *)&stride)) |
︙ | ︙ |