summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
77b4ec7)
The memory usage discipline of tag_op_list_t is never to free the
internal array of tag operations before freeing the whole list, so it
makes sense to take advantage of hierarchical de-allocation by talloc.
By not relying on the context passed into tag_parse_line, we can allow
tag_op_list_t structures to live longer than that context.
- if (tag_op_list_append (ctx, tag_ops, tok, FALSE))
+ if (tag_op_list_append (tag_ops, tok, FALSE))
- if (tag_op_list_append (ctx, tag_ops, tag, remove)) {
+ if (tag_op_list_append (tag_ops, tag, remove)) {
ret = line_error (TAG_PARSE_OUT_OF_MEMORY, line_for_error,
"aborting");
goto DONE;
ret = line_error (TAG_PARSE_OUT_OF_MEMORY, line_for_error,
"aborting");
goto DONE;
list->size = TAG_OP_LIST_INITIAL_SIZE;
list->count = 0;
list->size = TAG_OP_LIST_INITIAL_SIZE;
list->count = 0;
- list->ops = talloc_array (ctx, tag_operation_t, list->size);
+ list->ops = talloc_array (list, tag_operation_t, list->size);
if (list->ops == NULL)
return NULL;
if (list->ops == NULL)
return NULL;
-tag_op_list_append (void *ctx,
- tag_op_list_t *list,
+tag_op_list_append (tag_op_list_t *list,
const char *tag,
notmuch_bool_t remove)
{
const char *tag,
notmuch_bool_t remove)
{
if (list->count == list->size) {
list->size *= 2;
if (list->count == list->size) {
list->size *= 2;
- list->ops = talloc_realloc (ctx, list->ops, tag_operation_t,
+ list->ops = talloc_realloc (list, list->ops, tag_operation_t,
list->size);
if (list->ops == NULL) {
fprintf (stderr, "Out of memory.\n");
list->size);
if (list->ops == NULL) {
fprintf (stderr, "Out of memory.\n");
-tag_op_list_append (void *ctx,
- tag_op_list_t *list,
+tag_op_list_append (tag_op_list_t *list,
const char *tag,
notmuch_bool_t remove);
const char *tag,
notmuch_bool_t remove);