diff options
| author | Nalin Dahyabhai <nalin.dahyabhai@pobox.com> | 2008-06-25 17:50:00 -0400 |
|---|---|---|
| committer | Nalin Dahyabhai <nalin.dahyabhai@pobox.com> | 2008-06-25 17:50:00 -0400 |
| commit | fbd45de92c70a130d74a0d48f8975483ae21f68b (patch) | |
| tree | 89f98d26ae5dee17e989f55f09e109daf698326c /src/format.c | |
| parent | 878ab7f3622d4ea4f09035cf34e580925a8447ab (diff) | |
- don't require the caller to pass a pblock into format_format, since the only
caller always did anyway
Diffstat (limited to 'src/format.c')
| -rw-r--r-- | src/format.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/format.c b/src/format.c index c5c7a1f..6bd7d58 100644 --- a/src/format.c +++ b/src/format.c @@ -2081,18 +2081,20 @@ format_expand(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, } static char * -format_format(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, +format_format(struct plugin_state *state, Slapi_Entry *e, const char *domain, const char *map, const char *fmt, const char *disallowed, struct format_choice **choices, char ***ref_attrs, struct format_inref_attr ***inref_attrs) { + Slapi_PBlock *pb; char *buf, *tmp, *ret, *spd_id; const char *match, *fmtstart, *fmtend; int i, buflen, exp_len; spd_id = state->plugin_desc->spd_id; buflen = DEFAULT_BUFFER_SIZE; + pb = slapi_pblock_new(); do { buf = malloc(buflen); if (buf == NULL) { @@ -2102,6 +2104,7 @@ format_format(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, "for \"%s\" failing: out of memory\n", fmt, slapi_entry_get_ndn(e)); + slapi_pblock_destroy(pb); return NULL; } @@ -2151,6 +2154,8 @@ format_format(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, free(buf); } while (i == -ENOBUFS); + slapi_pblock_destroy(pb); + return ret; } @@ -2161,15 +2166,8 @@ format_get_data(struct plugin_state *state, Slapi_Entry *e, char ***ref_attrs, struct format_inref_attr ***inref_attrs) { - Slapi_PBlock *pb; - char ***ndn_list, **local_ndn_list, *ret; - - pb = slapi_pblock_new(); - ret = format_format(state, pb, e, domain, map, fmt, disallowed, - NULL, ref_attrs, inref_attrs); - slapi_pblock_destroy(pb); - - return ret; + return format_format(state, e, domain, map, fmt, disallowed, + NULL, ref_attrs, inref_attrs); } char * |
