[GRASS-SVN] r32695 - in grass/branches/develbranch_6: include lib/gis

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Aug 11 20:30:28 EDT 2008


Author: neteler
Date: 2008-08-11 20:30:28 -0400 (Mon, 11 Aug 2008)
New Revision: 32695

Modified:
   grass/branches/develbranch_6/include/gis.h
   grass/branches/develbranch_6/include/gisdefs.h
   grass/branches/develbranch_6/lib/gis/gisinit.c
Log:
glynn: check that the module was built with the same version of gis.h as libgis (merge from trunk, r31628 and a fix)

Modified: grass/branches/develbranch_6/include/gis.h
===================================================================
--- grass/branches/develbranch_6/include/gis.h	2008-08-12 00:20:53 UTC (rev 32694)
+++ grass/branches/develbranch_6/include/gis.h	2008-08-12 00:30:28 UTC (rev 32695)
@@ -38,6 +38,11 @@
 static const char *GRASS_copyright __attribute__ ((unused))
     = "GRASS GNU GPL licensed Software";
 
+#define GIS_H_VERSION "$Revision: 32674 $"
+
+#define G_gisinit(pgm) G__gisinit(GIS_H_VERSION, (pgm))
+#define G_no_gisinit() G__no_gisinit(GIS_H_VERSION)
+
 /* Define TRUE and FALSE for boolean comparisons */
 #ifndef TRUE
 #define TRUE 1

Modified: grass/branches/develbranch_6/include/gisdefs.h
===================================================================
--- grass/branches/develbranch_6/include/gisdefs.h	2008-08-12 00:20:53 UTC (rev 32694)
+++ grass/branches/develbranch_6/include/gisdefs.h	2008-08-12 00:30:28 UTC (rev 32695)
@@ -624,8 +624,8 @@
 int G_gishelp(const char *, const char *);
 
 /* gisinit.c */
-int G_gisinit(const char *);
-int G_no_gisinit(void);
+int G__gisinit(const char *, const char *);
+int G__no_gisinit(const char *);
 int G__check_gisinit(void);
 
 /* histo_eq.c */

Modified: grass/branches/develbranch_6/lib/gis/gisinit.c
===================================================================
--- grass/branches/develbranch_6/lib/gis/gisinit.c	2008-08-12 00:20:53 UTC (rev 32694)
+++ grass/branches/develbranch_6/lib/gis/gisinit.c	2008-08-12 00:30:28 UTC (rev 32695)
@@ -17,6 +17,7 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <stdlib.h>
+#include <string.h>
 #include <sys/stat.h>
 #include <locale.h>
 
@@ -40,7 +41,7 @@
  * \return exit() is called on error
  */
 
-int G_gisinit(const char *pgm)
+int G__gisinit(const char *version, const char *pgm)
 {
     char *mapset;
 
@@ -49,6 +50,9 @@
 
     G_set_program_name(pgm);
 
+    if (strcmp(version, GIS_H_VERSION) != 0)
+        G_fatal_error(_("Incompatible library version for module"));
+
     /* Make sure location and mapset are set */
     G_location_path();
     switch (G__mapset_permissions(mapset = G_mapset())) {
@@ -76,11 +80,14 @@
  * \return always returns 0 on success
  */
 
-int G_no_gisinit(void)
+int G__no_gisinit(const char *version)
 {
     if (initialized)
 	return 0;
 
+    if (strcmp(version, GIS_H_VERSION) != 0)
+        G_fatal_error(_("Incompatible library version for module"));
+
     gisinit();
 
     return 0;



More information about the grass-commit mailing list