diff options
Diffstat (limited to 'bindings/linux/stdlib.h')
-rw-r--r-- | bindings/linux/stdlib.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/bindings/linux/stdlib.h b/bindings/linux/stdlib.h new file mode 100644 index 0000000..8381b13 --- /dev/null +++ b/bindings/linux/stdlib.h @@ -0,0 +1,22 @@ +/* + * upb - a minimalist implementation of protocol buffers. + * + * Copyright (c) 2012 Google Inc. See LICENSE for details. + * Author: Josh Haberman <jhaberman@gmail.com> + * + * Linux-kernel implementations of some stdlib.h functions. + */ + +#include <linux/slab.h> + +#ifndef UPB_LINUX_STDLIB_H +#define UPB_LINUX_STDLIB_H + +static inline void *malloc(size_t size) { return kmalloc(size, GFP_ATOMIC); } +static inline void free(void *p) { kfree(p); } + +static inline void *realloc(void *p, size_t size) { + return krealloc(p, size, GFP_ATOMIC); +} + +#endif |