Changeset 60590


Ignore:
Timestamp:
May 29, 2014, 3:23:24 PM (10 years ago)
Author:
glynn
Message:

Add G_fatal_longjmp()

Location:
grass/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • grass/trunk/include/defs/gis.h

    r60515 r60590  
    6161#include <stdarg.h>
    6262#include <stdio.h>
     63#include <setjmp.h>
    6364#include <sys/types.h>
    6465#include <sys/stat.h>
     
    218219
    219220/* error.c */
     221jmp_buf *G_fatal_longjmp(int);
    220222int G_info_format(void);
    221223void G_message(const char *, ...) __attribute__ ((format(printf, 1, 2)));
  • grass/trunk/lib/gis/error.c

    r60289 r60590  
    1515#include <stdlib.h>
    1616#include <string.h>
     17#include <setjmp.h>
    1718#include <unistd.h>
    1819#include <time.h>
     
    5859static void log_error(const char *, int);
    5960
     61static int fatal_longjmp;
     62static jmp_buf fatal_jmp_buf;
     63
     64jmp_buf *G_fatal_longjmp(int enable)
     65{
     66    fatal_longjmp = enable;
     67    return &fatal_jmp_buf;
     68}
     69
    6070static void vfprint_error(int type, const char *template, va_list ap)
    6171{
     
    157167        vfprint_error(ERR, msg, ap);
    158168        va_end(ap);
     169    }
     170
     171    if (fatal_longjmp) {
     172        busy = 0;
     173        longjmp(fatal_jmp_buf, 1);
    159174    }
    160175
Note: See TracChangeset for help on using the changeset viewer.