pike.git / src / modules / Gdbm / gdbmmod.c

version» Context lines:

pike.git/src/modules/Gdbm/gdbmmod.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: gdbmmod.c,v 1.31 2006/03/18 18:53:23 grubba Exp $ + || $Id: gdbmmod.c,v 1.32 2006/03/18 22:34:27 grubba Exp $   */      #include "global.h"   #include "gdbm_machine.h"   #include "threads.h"      /* Todo: make sure only one thread accesses the same gdbmmod */      #include "interpret.h"   #include "svalue.h"
pike.git/src/modules/Gdbm/gdbmmod.c:44:    THIS->dbf=0;       THREADS_ALLOW();    mt_lock(& gdbm_lock);    gdbm_close(dbf);    mt_unlock(& gdbm_lock);    THREADS_DISALLOW();    }   }    + /* Compat with old gdbm. */ + #ifndef GDBM_SYNC + #define GDBM_SYNC 0 + #endif + #ifndef GDBM_NOLOCK + #define GDBM_NOLOCK 0 + #endif +    static int fixmods(char *mods)   {    int mode = 0;    int flags = GDBM_NOLOCK;    while(1)    {    switch(*(mods++))    {    case 0:    switch(mode) {
pike.git/src/modules/Gdbm/gdbmmod.c:72:    return GDBM_WRCREAT | flags;    case 0xf: /* rwct */    return GDBM_NEWDB | flags;    }       case 'r': case 'R': mode = 0x1; break;    case 'w': case 'W': mode = 0x3; break;    case 'c': case 'C': mode = 0x7; break;    case 't': case 'T': mode = 0xf; break;    -  /* Flags from this point on. */ +  /* +  * Flags from this point on. +  */    case 'f': case 'F': flags |= GDBM_FAST; break; -  /* NOTE: The following are new in Pike 7.7. */ - #ifndef GDBM_SYNC - #define GDBM_SYNC 0 - #endif - #ifndef GDBM_NOLOCK - #define GDBM_NOLOCK 0 - #endif -  case 's': case 'S': flags |= GDBM_SYNC; break; +     -  +  /* +  * NOTE: The following are new in Pike 7.7. +  */ +  +  case 's': case 'S': flags |= GDBM_SYNC; break;    /* NOTE: This flag is inverted! */    case 'l': case 'L': flags &= ~GDBM_NOLOCK; break;       default:    Pike_error("Bad mode flag '%c' in gdbm->open.\n", mods[-1]);    }    }   }      void gdbmmod_fatal(char *err)