static meta_entry_t *md_entry_clone(const meta_entry_t *orig) /* {{{ */ { meta_entry_t *copy; if (orig == NULL) return (NULL); copy = md_entry_clone_contents(orig); copy->next = md_entry_clone(orig->next); return (copy); } /* }}} meta_entry_t *md_entry_clone */
meta_data_t *meta_data_clone(meta_data_t *orig) /* {{{ */ { meta_data_t *copy; if (orig == NULL) return (NULL); copy = meta_data_create(); if (copy == NULL) return (NULL); pthread_mutex_lock(&orig->lock); copy->head = md_entry_clone(orig->head); pthread_mutex_unlock(&orig->lock); return (copy); } /* }}} meta_data_t *meta_data_clone */
static meta_entry_t *md_entry_clone (const meta_entry_t *orig) /* {{{ */ { meta_entry_t *copy; if (orig == NULL) return (NULL); copy = md_entry_alloc (orig->key); copy->type = orig->type; if (copy->type == MD_TYPE_STRING) copy->value.mv_string = strdup (orig->value.mv_string); else copy->value = orig->value; copy->next = md_entry_clone (orig->next); return (copy); } /* }}} meta_entry_t *md_entry_clone */