File: reproducible2.patch

package info (click to toggle)
liblucy-perl 0.3.3-7
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 9,384 kB
  • ctags: 8,533
  • sloc: ansic: 80,473; perl: 7,080; yacc: 681; java: 174; lex: 96; makefile: 21
file content (30 lines) | stat: -rw-r--r-- 866 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Author: Reiner Herrmann <reiner@reiner-h.de>
Description: Sort list of files searched by S_find_cfh in readdir order

--- a/clownfish/src/CFCHierarchy.c
+++ b/clownfish/src/CFCHierarchy.c
@@ -115,6 +115,16 @@
     }
 }
 
+/* From qsort(3) */
+static int cmpstringp(const void *p1, const void *p2)
+{
+    /* The actual arguments to this function are "pointers to
+     * pointers to char", but strcmp(3) arguments are "pointers
+     * to char", hence the following cast plus dereference */
+
+    return strcmp(* (char * const *) p1, * (char * const *) p2);
+}
+
 static char**
 S_find_cfh(char *dir, char **cfh_list, size_t num_cfh) {
     void *dirhandle = CFCUtil_opendir(dir);
@@ -152,6 +162,7 @@
         }
     }
 
+    qsort(cfh_list, num_cfh, sizeof(char*), cmpstringp);
     FREEMEM(full_path);
     CFCUtil_closedir(dirhandle, dir);
     return cfh_list;