Просмотр исходного кода

libcompat: Rename scandir function name arguments

Guillem Jover лет назад: 18
Родитель
Сommit
0617b54917
3 измененных файлов с 12 добавлено и 6 удалено
  1. 6 0
      ChangeLog
  2. 2 2
      libcompat/compat.h
  3. 4 4
      libcompat/scandir.c

+ 6 - 0
ChangeLog

@@ -1,3 +1,9 @@
+2008-09-14  Guillem Jover  <guillem@debian.org>
+
+	* libcompat/compat.h (scandir): Rename arguments from select to
+	filter and compar to cmp.
+	* libcompat/scandir.c (scandir): Likewise.
+
 2008-09-14  Guillem Jover  <guillem@debian.org>
 
 	* libcompat/compat.h (alphasort): Change argument types to match

+ 2 - 2
libcompat/compat.h

@@ -60,8 +60,8 @@ const char *strsignal(int);
 #ifndef HAVE_SCANDIR
 struct dirent;
 int scandir(const char *dir, struct dirent ***namelist,
-            int (*select)(const struct dirent *),
-            int (*compar)(const void *, const void *));
+            int (*filter)(const struct dirent *),
+            int (*cmp)(const void *, const void *));
 #endif
 
 #ifndef HAVE_ALPHASORT

+ 4 - 4
libcompat/scandir.c

@@ -28,8 +28,8 @@
 #ifndef HAVE_SCANDIR
 int
 scandir(const char *dir, struct dirent ***namelist,
-        int (*select)(const struct dirent *),
-        int (*compar)(const void *, const void *))
+        int (*filter)(const struct dirent *),
+        int (*cmp)(const void *, const void *))
 {
 	DIR *d;
 	int used, avail;
@@ -47,7 +47,7 @@ scandir(const char *dir, struct dirent ***namelist,
 		return -1;
 
 	while ((e = readdir(d)) != NULL) {
-		if (!select(e))
+		if (!filter(e))
 			continue;
 
 		m = malloc(sizeof(struct dirent) + strlen(e->d_name));
@@ -68,7 +68,7 @@ scandir(const char *dir, struct dirent ***namelist,
 	}
 	(*namelist)[used] = NULL;
 
-	qsort(*namelist, used, sizeof(struct dirent *), compar);
+	qsort(*namelist, used, sizeof(struct dirent *), cmp);
 
 	return used;
 }