[GRASS-SVN] r34550 - grass/branches/develbranch_6/lib/proj

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Nov 27 16:07:41 EST 2008


Author: neteler
Date: 2008-11-27 16:07:40 -0500 (Thu, 27 Nov 2008)
New Revision: 34550

Modified:
   grass/branches/develbranch_6/lib/proj/ellipse.c
Log:
glynn: Use automatic buffer instead of dynamic allocation (merge from trunk, r34412)

Modified: grass/branches/develbranch_6/lib/proj/ellipse.c
===================================================================
--- grass/branches/develbranch_6/lib/proj/ellipse.c	2008-11-27 21:05:46 UTC (rev 34549)
+++ grass/branches/develbranch_6/lib/proj/ellipse.c	2008-11-27 21:07:40 UTC (rev 34550)
@@ -196,7 +196,7 @@
 struct ellps_list *read_ellipsoid_table(int fatal)
 {
     FILE *fd;
-    char *file;
+    char file[GPATH_MAX];
     char buf[4096];
     char name[100], descr[1024], buf1[1024], buf2[1024];
     char badlines[1024];
@@ -207,14 +207,13 @@
 
     int count = 0;
 
-    G_asprintf(&file, "%s%s", G_gisbase(), ELLIPSOIDTABLE);
+    sprintf(file, "%s%s", G_gisbase(), ELLIPSOIDTABLE);
     fd = fopen(file, "r");
 
-    if (fd == NULL) {
-	perror(file);
+    if (!fd) {
 	(fatal ? G_fatal_error : G_warning)(
 	    _("Unable to open ellipsoid table file <%s>"), file);
-	return 0;
+	return NULL;
     }
 
     err = 0;
@@ -261,17 +260,15 @@
 
     fclose(fd);
 
-    if (!err) {
-	G_free(file);
+    if (!err)
 	return outputlist;
-    }
 
     (fatal ? G_fatal_error : G_warning)(
 	err == 1
 	? _("Line%s of ellipsoid table file <%s> is invalid")
 	: _("Lines%s of ellipsoid table file <%s> are invalid"),
 	badlines, file);
-    G_free(file);
+
     return outputlist;
 }
 



More information about the grass-commit mailing list