Rewrote format() parser to be re-entrant and easier to read

Added various optimizations
Fixed memory leak in sh_tinyhash
This commit is contained in:
David Anderson
2005-11-21 10:04:43 +00:00
parent f13599177f
commit c6fc34a64d
7 changed files with 269 additions and 276 deletions

View File

@ -87,6 +87,20 @@ int set_amxstring(AMX *amx, cell amx_addr, const char *source, int max)
return dest - start;
}
size_t get_amxstring_r(AMX *amx, cell amx_addr, char *destination, int maxlen)
{
register cell *source = (cell *)(amx->base + (int)(((AMX_HEADER *)amx->base)->dat + amx_addr));
register char *dest = destination;
char *start = dest;
while (*source && maxlen-- > 0)
*dest++=(char)(*source++);
if (dest)
*dest = '\0';
return --dest - start;
}
char* get_amxstring(AMX *amx, cell amx_addr, int id, int& len)
{
static char buffor[4][3072];