Changeset 244

Show
Ignore:
Timestamp:
17/06/07 11:13:00 (18 months ago)
Author:
smoku
Message:

Merged nullstring config option by Simon Wilkinson. Fixes #17

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/util/config.c

    r156 r244  
    210210                elem->attrs[elem->nvalues][j + 1] = pstrdupx(xhash_pool(c->hash), NAD_AVAL(bd.nad, attr), NAD_AVAL_L(bd.nad, attr)); 
    211211 
     212                /*  
     213                 * pstrdupx(blob, 0) returns NULL - which means that later 
     214                 * there's no way of telling whether an attribute is defined 
     215                 * as empty, or just not defined. This fixes that by creating 
     216                 * an empty string for attributes which are defined empty 
     217                 */ 
     218                if (NAD_AVAL_L(bd.nad, attr)==0) { 
     219                    elem->attrs[elem->nvalues][j + 1] = pstrdup(xhash_pool(c->hash), ""); 
     220                } else { 
     221                    elem->attrs[elem->nvalues][j + 1] = pstrdupx(xhash_pool(c->hash), NAD_AVAL(bd.nad, attr), NAD_AVAL_L(bd.nad, attr)); 
     222                } 
    212223                j += 2; 
    213224                attr = bd.nad->attrs[attr].next;