From 618fe19fcb626ff09336d27f31cbf5d9c315a5ff Mon Sep 17 00:00:00 2001 From: Nalin Dahyabhai Date: Tue, 19 Apr 2011 13:48:13 -0400 Subject: - speed up an add-to-list operation which did things the obvious way before --- src/format.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src/format.c') diff --git a/src/format.c b/src/format.c index 292dc57..40f0130 100644 --- a/src/format.c +++ b/src/format.c @@ -1,5 +1,5 @@ /* - * Copyright 2008,2010 Red Hat, Inc. + * Copyright 2008,2010,2011 Red Hat, Inc. * * This Program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -168,14 +168,10 @@ format_add_sdn_list(struct slapi_dn ***list, const char *dn) } ret = malloc((i + 2) * sizeof(struct slapi_dn*)); if (ret != NULL) { - for (i = 0; - (list != NULL) && (*list != NULL) && ((*list)[i] != NULL); - i++) { - ret[i] = slapi_sdn_dup((*list)[i]); - } + memcpy(ret, *list, i * sizeof(struct slapi_dn*)); ret[i++] = sdn; ret[i] = NULL; - format_free_sdn_list(*list); + free(*list); *list = ret; } return *list; -- cgit