]> mj.ucw.cz Git - libucw.git/commitdiff
Use LIKE_MALLOC and SENTINEL_CHECK for mempool operations.
authorMartin Mares <mj@ucw.cz>
Thu, 4 May 2006 20:55:57 +0000 (22:55 +0200)
committerMartin Mares <mj@ucw.cz>
Thu, 4 May 2006 20:55:57 +0000 (22:55 +0200)
lib/mempool.h

index 6f6a7ffe1387a161428d583e69d560656172d014..efb5fa1bfe86e211570ba0e5caf5c8026e1cc238 100644 (file)
@@ -24,10 +24,11 @@ struct mempool {
 struct mempool *mp_new(uns);
 void mp_delete(struct mempool *);
 void mp_flush(struct mempool *);
-void *mp_alloc(struct mempool *, uns);
-void *mp_alloc_zero(struct mempool *, uns);
+void *mp_alloc(struct mempool *, uns) LIKE_MALLOC;
+void *mp_alloc_zero(struct mempool *, uns) LIKE_MALLOC;
 
-static inline void *mp_alloc_fast(struct mempool *p, uns l)
+static inline void * LIKE_MALLOC
+mp_alloc_fast(struct mempool *p, uns l)
 {
   byte *f = (void *) (((addr_int_t) p->free + POOL_ALIGN - 1) & ~(addr_int_t)(POOL_ALIGN - 1));
   byte *ee = f + l;
@@ -37,7 +38,7 @@ static inline void *mp_alloc_fast(struct mempool *p, uns l)
   return f;
 }
 
-static inline void *mp_alloc_fast_noalign(struct mempool *p, uns l)
+static inline void * LIKE_MALLOC mp_alloc_fast_noalign(struct mempool *p, uns l)
 {
   byte *f = p->free;
   byte *ee = f + l;
@@ -62,19 +63,19 @@ mp_end_string(struct mempool *p, void *stop)
 
 /* mempool-str.c */
 
-char *mp_strdup(struct mempool *, char *);
-void *mp_memdup(struct mempool *, void *, uns);
-char *mp_multicat(struct mempool *, ...);
-static inline char *
+char *mp_strdup(struct mempool *, char *) LIKE_MALLOC;
+void *mp_memdup(struct mempool *, void *, uns) LIKE_MALLOC;
+char *mp_multicat(struct mempool *, ...) LIKE_MALLOC SENTINEL_CHECK;
+static inline char * LIKE_MALLOC
 mp_strcat(struct mempool *mp, char *x, char *y)
 {
   return mp_multicat(mp, x, y, NULL);
 }
-char *mp_strjoin(struct mempool *p, char **a, uns n, uns sep);
+char *mp_strjoin(struct mempool *p, char **a, uns n, uns sep) LIKE_MALLOC;
 
 /* mempool-fmt.c */
 
-char *mp_printf(struct mempool *p, char *fmt, ...) FORMAT_CHECK(printf,2,3);
-char *mp_vprintf(struct mempool *p, char *fmt, va_list args);
+char *mp_printf(struct mempool *p, char *fmt, ...) FORMAT_CHECK(printf,2,3) LIKE_MALLOC;
+char *mp_vprintf(struct mempool *p, char *fmt, va_list args) LIKE_MALLOC;
 
 #endif