[GRASS-SVN] r65563 - grass/trunk/general/g.list

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Jul 10 06:54:56 PDT 2015


Author: hcho
Date: 2015-07-10 06:54:56 -0700 (Fri, 10 Jul 2015)
New Revision: 65563

Modified:
   grass/trunk/general/g.list/list.c
Log:
g.list: Rename cmp to compare_elist

Modified: grass/trunk/general/g.list/list.c
===================================================================
--- grass/trunk/general/g.list/list.c	2015-07-10 12:19:47 UTC (rev 65562)
+++ grass/trunk/general/g.list/list.c	2015-07-10 13:54:56 UTC (rev 65563)
@@ -10,6 +10,7 @@
 
 static int region_overlaps(const struct Cell_head *, const char *, const char *,
 			   int);
+static int compare_elist(const void *, const void *);
 
 void make_list(struct elist **el, int *lcount, int *lalloc,
 	       const struct list *elem, const char *mapset,
@@ -69,20 +70,6 @@
     G_free(list);
 }
 
-int cmp(const void *a, const void *b)
-{
-    struct elist *al = (struct elist *)a;
-    struct elist *bl = (struct elist *)b;
-    int ret;
-
-    if (!(ret = strcmp(al->type, bl->type))) {
-	if (!(ret = strcmp(al->name, bl->name)))
-	    ret = strcmp(al->mapset, bl->mapset);
-    }
-
-    return ret;
-}
-
 void print_list(FILE *fp, struct elist *el, int count, const char *separator,
 		int add_type, int add_mapset)
 {
@@ -91,7 +78,7 @@
     if (!count)
 	return;
 
-    qsort(el, count, sizeof(struct elist), cmp);
+    qsort(el, count, sizeof(struct elist), compare_elist);
 
     for (i = 0; i < count; i++) {
 	int need_mapset = 0;
@@ -169,3 +156,17 @@
 	     window->west >= map_window.east ||
 	     window->east <= map_window.west);
 }
+
+static int compare_elist(const void *a, const void *b)
+{
+    struct elist *al = (struct elist *)a;
+    struct elist *bl = (struct elist *)b;
+    int ret;
+
+    if (!(ret = strcmp(al->type, bl->type))) {
+	if (!(ret = strcmp(al->name, bl->name)))
+	    ret = strcmp(al->mapset, bl->mapset);
+    }
+
+    return ret;
+}



More information about the grass-commit mailing list