diff options
author | jcid <devnull@localhost> | 2008-03-29 15:28:06 +0100 |
---|---|---|
committer | jcid <devnull@localhost> | 2008-03-29 15:28:06 +0100 |
commit | 66f72ec847a387e808b798172da882dde3f3dda7 (patch) | |
tree | be525b25538556e2cb4d38a19799be89773cc4a4 /dlib | |
parent | 072933308a1128555e6e56f519fdc9603d060d0f (diff) |
- Switched URL_DATA type from char* to a dStr.
Diffstat (limited to 'dlib')
-rw-r--r-- | dlib/dlib.c | 14 | ||||
-rw-r--r-- | dlib/dlib.h | 1 |
2 files changed, 14 insertions, 1 deletions
diff --git a/dlib/dlib.c b/dlib/dlib.c index b8786c15..78fa951d 100644 --- a/dlib/dlib.c +++ b/dlib/dlib.c @@ -210,7 +210,7 @@ Dstr *dStr_sized_new (int sz) Dstr *ds = dNew(Dstr, 1); ds->str = NULL; - dStr_resize(ds, sz, 0); + dStr_resize(ds, sz + 1, 0); /* (sz + 1) for the extra '\0' */ return ds; } @@ -403,6 +403,18 @@ void dStr_sprintfa (Dstr *ds, const char *format, ...) } /* + * Compare two dStrs. + */ +int dStr_cmp(Dstr *ds1, Dstr *ds2) +{ + int ret = 0; + + if (ds1 && ds2) + ret = memcmp(ds1->str, ds2->str, MIN(ds1->len+1, ds2->len+1)); + return ret; +} + +/* *- dList --------------------------------------------------------------------- */ diff --git a/dlib/dlib.h b/dlib/dlib.h index 743f55b5..3eeb34de 100644 --- a/dlib/dlib.h +++ b/dlib/dlib.h @@ -106,6 +106,7 @@ void dStr_vsprintfa (Dstr *ds, const char *format, va_list argp); void dStr_vsprintf (Dstr *ds, const char *format, va_list argp); void dStr_sprintf (Dstr *ds, const char *format, ...); void dStr_sprintfa (Dstr *ds, const char *format, ...); +int dStr_cmp(Dstr *ds1, Dstr *ds2); /* *-- dList -------------------------------------------------------------------- |