mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-05-06 07:51:18 +00:00
[qfcc] Add function to see if a string is in a pool
Makes for a nice string set.
This commit is contained in:
parent
9089744290
commit
65e7df44d3
2 changed files with 9 additions and 0 deletions
|
@ -42,6 +42,7 @@ strpool_t *strpool_new (void);
|
||||||
strpool_t *strpool_build (const char *strings, int size);
|
strpool_t *strpool_build (const char *strings, int size);
|
||||||
void strpool_delete (strpool_t *strpool);
|
void strpool_delete (strpool_t *strpool);
|
||||||
int strpool_addstr (strpool_t *strpool, const char *str);
|
int strpool_addstr (strpool_t *strpool, const char *str);
|
||||||
|
int strpool_findstr (strpool_t *strpool, const char *str);
|
||||||
|
|
||||||
/** Smart strdup.
|
/** Smart strdup.
|
||||||
|
|
||||||
|
|
|
@ -121,6 +121,14 @@ strpool_addstr (strpool_t *strpool, const char *str)
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
strpool_findstr (strpool_t *strpool, const char *str)
|
||||||
|
{
|
||||||
|
if (!str)
|
||||||
|
return 0;
|
||||||
|
return (intptr_t) Hash_Find (strpool->str_tab, str);
|
||||||
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
ss_get_key (const void *s, void *unused)
|
ss_get_key (const void *s, void *unused)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue