Minor adjustments

This commit is contained in:
Daniel_Cortez 2017-10-18 22:08:08 +07:00 committed by Alex Martin
parent f5ba1b4077
commit 03aaa4f2cd

View File

@ -2652,9 +2652,11 @@ static symbol2 *symbol_cache_remove(symbol *sym,int free_cache_sym)
symbol2 *parent_cache_sym=NULL; symbol2 *parent_cache_sym=NULL;
cache_sym=hashmap_get(&symbol_cache_map,sym->name); cache_sym=hashmap_get(&symbol_cache_map,sym->name);
for ( ;; ) {
if (cache_sym==NULL) if (cache_sym==NULL)
return NULL; return NULL;
while (cache_sym->symbol!=sym) { if (cache_sym->symbol==sym)
break;
parent_cache_sym=cache_sym; parent_cache_sym=cache_sym;
cache_sym=cache_sym->next; cache_sym=cache_sym->next;
} }
@ -2664,7 +2666,7 @@ static symbol2 *symbol_cache_remove(symbol *sym,int free_cache_sym)
} else { } else {
hashmap_remove(&symbol_cache_map,sym->name); hashmap_remove(&symbol_cache_map,sym->name);
if (cache_sym->next!=NULL) if (cache_sym->next!=NULL)
if (hashmap_put(&symbol_cache_map,sym->name,cache_sym->next)) if (hashmap_put(&symbol_cache_map,sym->name,cache_sym->next)==NULL)
error(103); /* insufficient memory */ error(103); /* insufficient memory */
} }
if (free_cache_sym) { if (free_cache_sym) {
@ -3157,14 +3159,23 @@ SC_FUNC int getlabel(void)
SC_FUNC char *itoh(ucell val) SC_FUNC char *itoh(ucell val)
{ {
static const char hex[16]= static const char hex[16]=
{ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
#if PAWN_CELL_SIZE==16
static char itohstr[5]=
{'\0','\0','\0','\0','\0'};
char *ptr=&itohstr[3];
#elif PAWN_CELL_SIZE==32
static char itohstr[9]=
{'\0','\0','\0','\0','\0','\0','\0','\0','\0'};
char *ptr=&itohstr[7];
#elif PAWN_CELL_SIZE==64
static char itohstr[17]= static char itohstr[17]=
{ '\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0' }; {'\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0'};
char *ptr=&itohstr[15]; char *ptr=&itohstr[15];
#else
#if PAWN_CELL_SIZE>64
#error Unsupported cell size #error Unsupported cell size
#endif #endif
do { do {
*ptr-- = hex[val&(ucell)0x0f]; *ptr-- = hex[val&(ucell)0x0f];
} while ((val>>=4)!=0); } while ((val>>=4)!=0);