summaryrefslogtreecommitdiff
path: root/dlib/dlib.c
diff options
context:
space:
mode:
authorjcid <devnull@localhost>2008-03-29 15:28:06 +0100
committerjcid <devnull@localhost>2008-03-29 15:28:06 +0100
commit66f72ec847a387e808b798172da882dde3f3dda7 (patch)
treebe525b25538556e2cb4d38a19799be89773cc4a4 /dlib/dlib.c
parent072933308a1128555e6e56f519fdc9603d060d0f (diff)
- Switched URL_DATA type from char* to a dStr.
Diffstat (limited to 'dlib/dlib.c')
-rw-r--r--dlib/dlib.c14
1 files changed, 13 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 ---------------------------------------------------------------------
*/