12c1425efebb7ddd968ee476054b13d721df8df8 angie Tue Dec 18 11:47:17 2012 -0800 Code Review #9844 - Hiram pointed out that localmem.h is not protectedagainst multiple inclusion; fixed. Also cleaned up some redundant inclusions of localmem.h in files that already include bbiFile.h. diff --git src/inc/localmem.h src/inc/localmem.h index e5da176..7f85558 100644 --- src/inc/localmem.h +++ src/inc/localmem.h @@ -1,24 +1,27 @@ /* LocalMem.h - local memory routines. * * These routines are meant for the sort of scenario where * a lot of little to medium size pieces of memory are * allocated, and then disposed of all at once. * * This file is copyright 2002 Jim Kent, but license is hereby * granted for all use - public, private or commercial. */ +#ifndef LOCALMEM_H +#define LOCALMEM_H + struct lm *lmInit(int blockSize); /* Create a local memory pool. Parameters are: * blockSize - how much system memory to allocate at a time. Can * pass in zero and a reasonable default will be used. */ void lmCleanup(struct lm **pLm); /* Clean up a local memory pool. */ void *lmAlloc(struct lm *lm, size_t size); /* Allocate memory from local pool. */ char *lmCloneString(struct lm *lm, char *string); /* Return local mem copy of string. */ @@ -33,15 +36,17 @@ * not that many words in line. */ struct slName *lmSlName(struct lm *lm, char *name); /* Return slName in memory. */ void *lmCloneMem(struct lm *lm, void *pt, size_t size); /* Return a local mem copy of memory block. */ #define lmAllocVar(lm, pt) (pt = lmAlloc(lm, sizeof(*pt))); /* Shortcut to allocating a single variable in local mem and * assigning pointer to it. */ #define lmAllocArray(lm, pt, size) (pt = lmAlloc(lm, sizeof(*pt) * (size))) /* Shortcut to allocating an array in local mem and * assigning pointer to it. */ + +#endif//ndef LOCALMEM_H