[GRASS-SVN] r34412 - grass/trunk/lib/proj
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Nov 20 16:07:54 EST 2008
Author: glynn
Date: 2008-11-20 16:07:53 -0500 (Thu, 20 Nov 2008)
New Revision: 34412
Modified:
grass/trunk/lib/proj/ellipse.c
Log:
Use automatic buffer instead of dynamic allocation
Modified: grass/trunk/lib/proj/ellipse.c
===================================================================
--- grass/trunk/lib/proj/ellipse.c 2008-11-20 21:05:50 UTC (rev 34411)
+++ grass/trunk/lib/proj/ellipse.c 2008-11-20 21:07:53 UTC (rev 34412)
@@ -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