version 1.5 | | version 1.6 |
---|
| | |
/* | | /* |
* static char *rcsid_shstr_c = | | * static char *rcsid_shstr_c = |
* "$Id: shstr.c,v 1.5 2005/08/12 08:18:59 ryo_saeba Exp $"; | | * "$Id: shstr.c,v 1.6 2005/08/12 13:46:34 ryo_saeba Exp $"; |
* | | * |
* shstr.c | | * shstr.c |
* | | * |
| | |
* - pointer to string identical to str | | * - pointer to string identical to str |
*/ | | */ |
| | |
char * | | const char * |
add_string(const char *str) { | | add_string(const char *str) { |
shared_string *ss; | | shared_string *ss; |
int ind; | | int ind; |
| | |
* - str | | * - str |
*/ | | */ |
| | |
char * | | const char * |
add_refcount(char *str) { | | add_refcount(const char *str) { |
GATHER(add_ref_stats.calls); | | GATHER(add_ref_stats.calls); |
++(SS(str)->refcount); | | ++(SS(str)->refcount); |
/* This function should be declared | | /* This function should be declared |
* const char *add_refcount(const char *) | | * const char *add_refcount(const char *) |
* Unfortunately, that would require changing a lot of structs | | * Unfortunately, that would require changing a lot of structs |
| | * |
| | * Yup, many changes, but may have make some bugs more visible :) |
| | * -- Ryo 2005-08-12 |
*/ | | */ |
return str; | | return (char*)str; |
} | | } |
| | |
/* | | /* |
| | |
* - pointer to identical string or NULL | | * - pointer to identical string or NULL |
*/ | | */ |
| | |
char * | | const char * |
find_string(const char *str) { | | find_string(const char *str) { |
shared_string *ss; | | shared_string *ss; |
int ind; | | int ind; |
| | |
*/ | | */ |
| | |
void | | void |
free_string(char *str) { | | free_string(const char *str) { |
shared_string *ss; | | shared_string *ss; |
| | |
GATHER(free_stats.calls); | | GATHER(free_stats.calls); |
| | |
* - a string or NULL | | * - a string or NULL |
*/ | | */ |
| | |
char * | | const char * |
ss_dump_table(int what) { | | ss_dump_table(int what) { |
static char totals[80]; | | static char totals[80]; |
int entries = 0, refs = 0, links = 0; | | int entries = 0, refs = 0, links = 0; |