summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorOleg Safiullin <form@cvs.openbsd.org>2009-01-29 11:21:43 +0000
committerOleg Safiullin <form@cvs.openbsd.org>2009-01-29 11:21:43 +0000
commitbbdec7810aa42e5cd7a313190495c30bec650ef2 (patch)
treea9cdf336991c173c1efaa77a993938d3d77ad609 /usr.sbin
parentf5f79c1f8e5a4e6c393e030d179bc215aa19d183 (diff)
No need to use RB_FIND here, RB_INSERT does that job for us.
ok aschrijver@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ypldap/ypldap.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/usr.sbin/ypldap/ypldap.c b/usr.sbin/ypldap/ypldap.c
index 714f589ca20..d55eacb0e79 100644
--- a/usr.sbin/ypldap/ypldap.c
+++ b/usr.sbin/ypldap/ypldap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ypldap.c,v 1.6 2008/09/30 16:24:16 aschrijver Exp $ */
+/* $OpenBSD: ypldap.c,v 1.7 2009/01/29 11:21:42 form Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -176,14 +176,12 @@ main_dispatch_client(int fd, short event, void *p)
ue->ue_uid = ir.ir_key.ik_uid;
len = strlen(ue->ue_line) + 1;
ue->ue_line[strcspn(ue->ue_line, ":")] = '\0';
- if (RB_FIND(user_name_tree, env->sc_user_names_t,
+ if (RB_INSERT(user_name_tree, env->sc_user_names_t,
ue) != NULL) { /* dup */
free(ue->ue_line);
free(ue);
- break;
- }
- RB_INSERT(user_name_tree, env->sc_user_names_t, ue);
- env->sc_user_line_len += len;
+ } else
+ env->sc_user_line_len += len;
break;
}
case IMSG_GRP_ENTRY: {
@@ -201,14 +199,12 @@ main_dispatch_client(int fd, short event, void *p)
ge->ge_gid = ir.ir_key.ik_gid;
len = strlen(ge->ge_line) + 1;
ge->ge_line[strcspn(ge->ge_line, ":")] = '\0';
- if (RB_FIND(group_name_tree, env->sc_group_names_t,
+ if (RB_INSERT(group_name_tree, env->sc_group_names_t,
ge) != NULL) { /* dup */
free(ge->ge_line);
free(ge);
- break;
- }
- RB_INSERT(group_name_tree, env->sc_group_names_t, ge);
- env->sc_group_line_len += len;
+ } else
+ env->sc_group_line_len += len;
break;
}
case IMSG_TRASH_UPDATE: {