diff options
| author | Nalin Dahyabhai <nalin.dahyabhai@pobox.com> | 2008-11-04 15:25:10 -0500 |
|---|---|---|
| committer | Nalin Dahyabhai <nalin.dahyabhai@pobox.com> | 2008-11-04 15:25:10 -0500 |
| commit | 4014f1b815f6e6b2bd67112b374fd3c67ac09517 (patch) | |
| tree | 460821f123fbfd80f90f3afd8cb413556b8b81c7 /src | |
| parent | a0e830deebd25457c53de135e770fb49bf00e384 (diff) | |
- stop deref_r() and referred_r() stop returning empty strings when they
find nothing -- that was throwing things off
- add a combined check for collect, ifeq, and deref_r
Diffstat (limited to 'src')
| -rw-r--r-- | src/format.c | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/src/format.c b/src/format.c index c738ff9..2f78ccd 100644 --- a/src/format.c +++ b/src/format.c @@ -1115,11 +1115,9 @@ format_deref_r(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, if (cvalue == NULL) { continue; } -#if 1 /* Let's visit the named entry this * time, in case we're nesting. */ format_add_sdn_list(&these, cvalue); -#endif /* We need to visit the named entry * next time. */ format_add_sdn_list(&next, cvalue); @@ -1156,9 +1154,10 @@ format_deref_r(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, if (choices != NULL) { format_add_choice(outbuf_choices, outbuf, choices); format_free_bv_list(choices); + return 0; + } else { + return -ENOENT; } - - return 0; } /* Look up entries in the set named by the first argument, which have this @@ -1638,16 +1637,17 @@ format_referred_r(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, } format_free_sdn_list(these_entries); + slapi_pblock_destroy(local_pb); + format_free_parsed_args(argv); + /* Return any values we found. */ if (choices != NULL) { format_add_choice(outbuf_choices, outbuf, choices); format_free_bv_list(choices); + return 0; + } else { + return -ENOENT; } - - slapi_pblock_destroy(local_pb); - format_free_parsed_args(argv); - - return 0; } /* Evaluate each argument's list of results, after the first, in turn, and @@ -1700,10 +1700,6 @@ format_merge(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, continue; } for (j = 0; values[j] != NULL; j++) { - /* Check for a non-empty value. */ - if (lengths[j] == 0) { - continue; - } /* Check if there's space for this value. */ if (ret + lengths[j] + (count ? slen : 0) > (unsigned int) outbuf_len) { @@ -2267,10 +2263,6 @@ format_collect(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, if (values != NULL) { /* Walk the list of values. */ for (j = 0; values[j] != NULL; j++) { - /* Check for a non-empty value. */ - if (lengths[j] == 0) { - continue; - } /* Add it to the list. */ bv.bv_val = values[j]; bv.bv_len = lengths[j]; |
