OSSP CVS Repository

ossp - Difference in ossp-pkg/val/val.c versions 1.14 and 1.15
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/val/val.c 1.14 -> 1.15

--- val.c        2003/02/06 16:58:40     1.14
+++ val.c        2003/02/17 14:35:25     1.15
@@ -107,7 +107,7 @@
 typedef struct segment_st segment_t;
 struct segment_st {
     element_t *s_element[SEGMENTSIZE]; /* array of pointers to elements */
-}; 
+};
 
 /* the top-level hash table structure */
 struct lh_st {
@@ -139,7 +139,7 @@
  * signature). It can be definetely recommended as a good general
  * purpose hash function.
  */
-static long 
+static long
 lh_hash(
     register const unsigned char *k,
     register size_t length)
@@ -176,7 +176,7 @@
 
     /* handle the last 11 bytes */
     c += length;
-    switch(len) { 
+    switch(len) {
         /* all the case statements fall through */
         case 11: c+=((ub4)k[10]<<24);
         case 10: c+=((ub4)k[ 9]<<16);
@@ -220,7 +220,7 @@
 
     /* allocate and clear first segment of hash table array */
     if ((h->h_dir[0] = (segment_t *)malloc(sizeof(segment_t))) == NULL) {
-        free(h->h_dir); 
+        free(h->h_dir);
         free(h);
         return NULL;
     }
@@ -243,7 +243,7 @@
     element_t **pelold;
     element_t *el, *headofold, *headofnew, *next;
     unsigned int n;
-    
+
     /* calculate next new address */
     pmax0   = h->h_pmax;
     newaddr = pmax0 + h->h_p;
@@ -257,7 +257,7 @@
              return;
         memset((char *)h->h_dir+n, 0, n);
     }
-    
+
     /* have to create a new table segment? */
     if (SEGINDEX(newaddr) == 0) {
         if ((seg = (segment_t *)malloc(sizeof(segment_t))) == NULL)
@@ -275,7 +275,7 @@
         h->h_p = 0;
     }
     h->h_slack += MAXLOADFCTR;
-    
+
     /* relocate and split between P-element new element */
     headofold = NULL;
     headofnew = NULL;
@@ -369,7 +369,7 @@
     /* check whether element is already in the hash table */
     bFound = FALSE;
     for (el = *pel; el != NULL; el = el->e_next) {
-        if (   el->e_hash == hash 
+        if (   el->e_hash == hash
             && el_keylen(el) == keylen
             && memcmp(el->e_keyptr, keyptr, el_keylen(el)) == 0) {
             bFound = TRUE;
@@ -440,7 +440,7 @@
 
     /* search for element in collision list */
     for (el = *pel; el != NULL; el = el->e_next) {
-        if (   el->e_hash == hash 
+        if (   el->e_hash == hash
             && el_keylen(el) == keylen
             && memcmp(el->e_keyptr, keyptr, el_keylen(el)) == 0) {
             /* provide results */
@@ -477,7 +477,7 @@
     /* search for element in collision chain */
     rv = FALSE;
     for (lel = NULL, el = *pel; el != NULL; lel = el, el = el->e_next) {
-        if (   el->e_hash == hash 
+        if (   el->e_hash == hash
             && el_keylen(el) == keylen
             && memcmp(el->e_keyptr, keyptr, el_keylen(el)) == 0) {
             /* free key+data memory chunk */
@@ -485,7 +485,7 @@
                 free(el->e_datptr);
             /* remove element from collision chain */
             if (lel == NULL)
-                *pel = el->e_next; 
+                *pel = el->e_next;
             else
                 lel->e_next = el->e_next;
             /* deallocate element structure */
@@ -581,7 +581,7 @@
 **  full-featured linear hashing library.
 */
 
-/* 
+/*
  * usually val_object_t.data is a pointer val_object_t.data.p,
  * but VAL_INLINE signals val_object_t.data is actual data
  * val_object_t.data.[csilfd].
@@ -634,7 +634,7 @@
             default:              storage = NULL; break; /* cannot happen */
         }
     }
-    else 
+    else
         storage = obj->data.p;
 
     return storage;
@@ -666,12 +666,12 @@
 }
 
 /* internal lh_apply() callback for use with val_destroy() */
-static int val_destroy_cb(void *_ctx, 
-                          const void *keyptr, int keylen, 
+static int val_destroy_cb(void *_ctx,
+                          const void *keyptr, int keylen,
                           const void *datptr, int datlen)
 {
     val_object_t *obj;
-    
+
     /* free description string */
     if ((obj = (val_object_t *)datptr) != NULL)
         if (obj->desc != NULL)
@@ -727,7 +727,7 @@
         newobj.desc = strdup(desc);
     else
         newobj.desc = NULL;
-    if (storage == NULL) { 
+    if (storage == NULL) {
         newobj.type   = (type | VAL_INLINE);
         newobj.data.l = 0;
     }
@@ -779,7 +779,7 @@
 }
 
 /* query information about a value */
-val_rc_t val_query(val_t *val, const char *name, 
+val_rc_t val_query(val_t *val, const char *name,
                    int *ptype, char **pdesc, void **pstorage)
 {
     char *cp;
@@ -890,7 +890,7 @@
     /* argument consistency check */
     if (val == NULL || name == NULL || ap == NULL)
         return VAL_RC(VAL_ERR_ARG);
-    
+
     /* recursive step-down on structured name */
     if ((cp = strchr(name, '.')) != NULL) {
         if (!lh_lookup(val->lh, name, cp-name, (void **)&obj, NULL))
@@ -934,7 +934,7 @@
     /* argument consistency check */
     if (val == NULL || name == NULL)
         return VAL_RC(VAL_ERR_ARG);
-    
+
     /* just pass-through to va_list variant */
     va_start(ap, name);
     rc = val_vget(val, name, ap);
@@ -981,7 +981,7 @@
     strncat(name, (char *)keyptr, keylen);
 
     /* recursive step-down */
-    if ((ctx->rc = val_apply_internal(ctx->val, name, prefixlen, 
+    if ((ctx->rc = val_apply_internal(ctx->val, name, prefixlen,
                                       ctx->depth, ctx->cb, ctx->ctx)) != VAL_OK)
         return FALSE;
 
@@ -989,7 +989,7 @@
 }
 
 /* internal API-increased variant of val_apply() */
-static val_rc_t val_apply_internal(val_t *val, const char *name, int prefixlen, 
+static val_rc_t val_apply_internal(val_t *val, const char *name, int prefixlen,
                                    int depth, val_cb_t cb, void *ctx)
 {
     val_object_t *obj;
@@ -999,7 +999,7 @@
     val_apply_ctx_t val_ctx;
 
     if (name[prefixlen] == '\0') {
-        /* CASE 1: apply to all elements 
+        /* CASE 1: apply to all elements
            prefix="foo.bar.", remainder="" */
         val_ctx.val       = val;
         val_ctx.name      = (char *)name;
@@ -1027,7 +1027,7 @@
            prefix="foo.bar.quux.", remainder="baz" */
         if (!lh_lookup(val->lh, name+prefixlen, strlen(name+prefixlen), (void **)&obj, NULL))
             return VAL_RC(VAL_ERR_ARG);
-        if ((rc = cb(ctx, name, (obj->type & ~VAL_INLINE), 
+        if ((rc = cb(ctx, name, (obj->type & ~VAL_INLINE),
                      obj->desc, val_storage(obj))) != VAL_OK)
             return VAL_RC(rc);
         if (obj->type & VAL_TYPE_VAL) {

CVSTrac 2.0.1