[GRASS-SVN] r31628 - in grass/trunk: include lib/gis
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Jun 4 14:48:33 EDT 2008
Author: glynn
Date: 2008-06-04 14:48:32 -0400 (Wed, 04 Jun 2008)
New Revision: 31628
Modified:
grass/trunk/include/gis.h
grass/trunk/include/gisdefs.h
grass/trunk/lib/gis/gisinit.c
Log:
Add gis.h version check
Modified: grass/trunk/include/gis.h
===================================================================
--- grass/trunk/include/gis.h 2008-06-04 18:20:05 UTC (rev 31627)
+++ grass/trunk/include/gis.h 2008-06-04 18:48:32 UTC (rev 31628)
@@ -42,6 +42,9 @@
#define GIS_H_VERSION "$Revision$"
+#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/trunk/include/gisdefs.h
===================================================================
--- grass/trunk/include/gisdefs.h 2008-06-04 18:20:05 UTC (rev 31627)
+++ grass/trunk/include/gisdefs.h 2008-06-04 18:48:32 UTC (rev 31628)
@@ -588,8 +588,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/trunk/lib/gis/gisinit.c
===================================================================
--- grass/trunk/lib/gis/gisinit.c 2008-06-04 18:20:05 UTC (rev 31627)
+++ grass/trunk/lib/gis/gisinit.c 2008-06-04 18:48:32 UTC (rev 31628)
@@ -14,6 +14,7 @@
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
+#include <string.h>
#include <sys/stat.h>
#include <grass/gis.h>
#include "G.h"
@@ -36,7 +37,7 @@
* \return exit() is called on error
*/
-int G_gisinit(const char *pgm)
+int G__gisinit(const char *version, const char *pgm)
{
char *mapset;
@@ -45,6 +46,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()))
@@ -75,11 +79,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