summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-03-17 17:20:24 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:57:37 -0500
commit2584a532e0a5d6b69c094c0a36de538c4b3c5168 (patch)
tree7cae79c7946304604db79f7305c0722dcc392f98 /source4
parentc67fd3f0e834841d4e7d13b5517f45eec8d1085c (diff)
downloadsamba-2584a532e0a5d6b69c094c0a36de538c4b3c5168.tar.gz
samba-2584a532e0a5d6b69c094c0a36de538c4b3c5168.tar.bz2
samba-2584a532e0a5d6b69c094c0a36de538c4b3c5168.zip
r14525: Sort list of torture tests alphabetically
(This used to be commit 48941ecc870ac96a944beb5657950ad3ec1f1f11)
Diffstat (limited to 'source4')
-rw-r--r--source4/torture/torture.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/source4/torture/torture.c b/source4/torture/torture.c
index 4627164bef..d56e550703 100644
--- a/source4/torture/torture.c
+++ b/source4/torture/torture.c
@@ -747,36 +747,33 @@ static void register_builtin_ops(void)
}
}
-
struct torture_op *torture_ops = NULL;
-static struct torture_op *find_torture_op(const char *name)
-{
- struct torture_op *o;
- for (o = torture_ops; o; o = o->next) {
- if (strcmp(name, o->name) == 0)
- return o;
- }
-
- return NULL;
-}
-
_PUBLIC_ NTSTATUS register_torture_op(const char *name, BOOL (*fn)(void), BOOL (*multi_fn)(struct smbcli_state *, int ))
{
- struct torture_op *op;
+ struct torture_op *op, *p;
- /* Check for duplicates */
- if (find_torture_op(name) != NULL) {
- DEBUG(0,("There already is a torture op registered with the name %s!\n", name));
- return NT_STATUS_OBJECT_NAME_COLLISION;
- }
-
op = talloc(talloc_autofree_context(), struct torture_op);
op->name = talloc_strdup(op, name);
op->fn = fn;
op->multi_fn = multi_fn;
+ for (p = torture_ops; p; p = p->next) {
+ if (strcmp(p->name, op->name) == 0) {
+ /* Check for duplicates */
+ DEBUG(0,("There already is a torture op registered with the name %s!\n", name));
+ talloc_free(op);
+ return NT_STATUS_OBJECT_NAME_COLLISION;
+ }
+
+ if (strcmp(p->name, op->name) < 0 &&
+ (!p->next || strcmp(p->next->name, op->name) > 0)) {
+ DLIST_ADD_AFTER(torture_ops, op, p);
+ return NT_STATUS_OK;
+ }
+ }
+
DLIST_ADD(torture_ops, op);
return NT_STATUS_OK;