[GRASS-SVN] r61451 - in grass/branches/releasebranch_7_0: . include/defs lib/gis
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Jul 29 14:08:43 PDT 2014
Author: neteler
Date: 2014-07-29 14:08:42 -0700 (Tue, 29 Jul 2014)
New Revision: 61451
Modified:
grass/branches/releasebranch_7_0/
grass/branches/releasebranch_7_0/include/defs/gis.h
grass/branches/releasebranch_7_0/lib/gis/error.c
Log:
libgis: Add G_fatal_longjmp() (trunk, r60590)
Property changes on: grass/branches/releasebranch_7_0
___________________________________________________________________
Added: svn:mergeinfo
+ /grass/trunk:60590
Modified: grass/branches/releasebranch_7_0/include/defs/gis.h
===================================================================
--- grass/branches/releasebranch_7_0/include/defs/gis.h 2014-07-29 19:59:40 UTC (rev 61450)
+++ grass/branches/releasebranch_7_0/include/defs/gis.h 2014-07-29 21:08:42 UTC (rev 61451)
@@ -60,6 +60,7 @@
#include <stdarg.h>
#include <stdio.h>
+#include <setjmp.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -217,6 +218,7 @@
void G_switch_env(void);
/* error.c */
+jmp_buf *G_fatal_longjmp(int);
int G_info_format(void);
void G_message(const char *, ...) __attribute__ ((format(printf, 1, 2)));
void G_verbose_message(const char *, ...)
Modified: grass/branches/releasebranch_7_0/lib/gis/error.c
===================================================================
--- grass/branches/releasebranch_7_0/lib/gis/error.c 2014-07-29 19:59:40 UTC (rev 61450)
+++ grass/branches/releasebranch_7_0/lib/gis/error.c 2014-07-29 21:08:42 UTC (rev 61451)
@@ -14,6 +14,7 @@
#include <stdlib.h>
#include <string.h>
+#include <setjmp.h>
#include <unistd.h>
#include <time.h>
#include <stdarg.h>
@@ -58,6 +59,15 @@
static int write_error(const char *, int, time_t, const char *);
static void log_error(const char *, int);
+static int fatal_longjmp;
+static jmp_buf fatal_jmp_buf;
+
+jmp_buf *G_fatal_longjmp(int enable)
+{
+ fatal_longjmp = enable;
+ return &fatal_jmp_buf;
+}
+
static void vfprint_error(int type, const char *template, va_list ap)
{
char buffer[2000]; /* G_asprintf does not work */
@@ -159,6 +169,11 @@
va_end(ap);
}
+ if (fatal_longjmp) {
+ busy = 0;
+ longjmp(fatal_jmp_buf, 1);
+ }
+
G__call_error_handlers();
/* Raise SIGSEGV, useful for debugging only.
More information about the grass-commit
mailing list