summaryrefslogtreecommitdiffstats
path: root/src/format.c
diff options
context:
space:
mode:
authorNalin Dahyabhai <nalin@dahyabhai.net>2011-04-19 13:48:13 -0400
committerNalin Dahyabhai <nalin@dahyabhai.net>2011-04-19 13:48:13 -0400
commit618fe19fcb626ff09336d27f31cbf5d9c315a5ff (patch)
treeaf9697e968c71b3a67998d813c04fda661ca38e0 /src/format.c
parent10a8de94e9da6b769a5b5a386449a8b882bd34af (diff)
downloadslapi-nis-618fe19fcb626ff09336d27f31cbf5d9c315a5ff.tar.gz
slapi-nis-618fe19fcb626ff09336d27f31cbf5d9c315a5ff.tar.xz
slapi-nis-618fe19fcb626ff09336d27f31cbf5d9c315a5ff.zip
- speed up an add-to-list operation which did things the obvious way before
Diffstat (limited to 'src/format.c')
-rw-r--r--src/format.c10
1 files changed, 3 insertions, 7 deletions
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;