SecBSD's official ports repository
This commit is contained in:
commit
2c0afcbbf3
64331 changed files with 5339189 additions and 0 deletions
47
editors/ldapvi/patches/patch-diff_c
Normal file
47
editors/ldapvi/patches/patch-diff_c
Normal file
|
@ -0,0 +1,47 @@
|
|||
preserve order of attribute values, from git upstream 3ae1458bb7
|
||||
|
||||
--- diff.c.orig Sat May 5 11:17:26 2007
|
||||
+++ diff.c Thu Mar 1 22:19:30 2012
|
||||
@@ -46,22 +46,32 @@ compare_ptr_arrays(GPtrArray *a, GPtrArray *b,
|
||||
for (; i < a->len; i++) note(g_ptr_array_index(a, i), 0, x);
|
||||
}
|
||||
|
||||
-static void
|
||||
-note_values(GArray *a, GArray *b, int *changed)
|
||||
+static int
|
||||
+ordered_array_equal(GPtrArray *a, GPtrArray *b,
|
||||
+ int (*cmp)(const void *, const void *))
|
||||
{
|
||||
- if (!(a && b)) *changed = 1;
|
||||
+ int i;
|
||||
+
|
||||
+ if (a->len != b->len)
|
||||
+ return 0;
|
||||
+
|
||||
+ for (i = 0; i < a->len; i++) {
|
||||
+ void *ax = g_ptr_array_index(a, i);
|
||||
+ void *bx = g_ptr_array_index(b, i);
|
||||
+ if (cmp(&ax, &bx))
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
compare_attributes(tattribute *clean, tattribute *new, GPtrArray *mods)
|
||||
{
|
||||
- int changed = 0;
|
||||
- compare_ptr_arrays(attribute_values(clean),
|
||||
- attribute_values(new),
|
||||
- carray_ptr_cmp,
|
||||
- (note_function) note_values,
|
||||
- &changed);
|
||||
- if (changed) {
|
||||
+ if (!ordered_array_equal(attribute_values(clean),
|
||||
+ attribute_values(new),
|
||||
+ carray_ptr_cmp))
|
||||
+ {
|
||||
LDAPMod *m = attribute2mods(new);
|
||||
m->mod_op |= LDAP_MOD_REPLACE;
|
||||
g_ptr_array_add(mods, m);
|
Loading…
Add table
Add a link
Reference in a new issue