Changeset 492
- Timestamp:
- Aug 1, 2003, 3:44:59 AM (22 years ago)
- Location:
- trunk/src/emx/src/emxomf
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/src/emxomf/grow.c
-
Property cvs2svn:cvs-rev
changed from
1.3
to1.4
r491 r492 36 36 #include <stdlib.h> 37 37 #include <string.h> 38 #include <ctype.h> 38 39 #include "defs.h" 39 40 #include "grow.h" … … 332 333 return strpool_addn (p, s, strlen (s)); 333 334 } 335 336 /* Add the uppercased string S of LEN characters to the string pool P. 337 See strpool_addn for more details. */ 338 339 const char *strpool_addnu (struct strpool *p, const char *s, int len) 340 { 341 unsigned hash; 342 int i; 343 struct string *v; 344 345 hash = 0; 346 for (i = 0; i < len; ++i) 347 hash = hash * 65599 + toupper(s[i]); 348 hash %= STRPOOL_HASH_SIZE; 349 for (v = p->table[hash]; v != NULL; v = v->next) 350 if (strlen (v->string) == len && memcmp (v->string, s, len) == 0) 351 return v->string; 352 v = xmalloc (sizeof (*v) + len); 353 memcpy (v->string, s, len); 354 v->string[len] = 0; 355 strupr(v->string); 356 v->next = p->table[hash]; 357 p->table[hash] = v; 358 return v->string; 359 } 360 361 /* Add the null-terminated uppercased string S to the string pool P. 362 See strpool_add for more details. */ 363 364 const char *strpool_addu (struct strpool *p, const char *s) 365 { 366 if (s == NULL) 367 return NULL; 368 return strpool_addnu (p, s, strlen (s)); 369 } 370 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/emxomf/grow.h
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r491 r492 59 59 const char *strpool_addn (struct strpool *p, const char *s, int len); 60 60 const char *strpool_add (struct strpool *p, const char *s); 61 const char *strpool_addnu ( struct strpool *p, const char *s, int len); 62 const char *strpool_addu ( struct strpool *p, const char *s); -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.