File: jv_alloc.h

package info (click to toggle)
jq 1.4-2.1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 1,216 kB
  • sloc: ansic: 9,370; yacc: 588; lex: 175; makefile: 95; sh: 56; python: 21
file content (23 lines) | stat: -rw-r--r-- 476 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifndef JV_ALLOC_H
#define JV_ALLOC_H

#include <stddef.h>
#include "jv.h"

#ifndef NDEBUG
extern volatile char jv_mem_uninitialised;
#endif

static void jv_mem_invalidate(void* mem, size_t n) {
#ifndef NDEBUG
  char* m = mem;
  while (n--) *m++ ^= jv_mem_uninitialised ^ jv_mem_uninitialised;
#endif
}

void* jv_mem_alloc(size_t);
void* jv_mem_alloc_unguarded(size_t);
void jv_mem_free(void*);
__attribute__((warn_unused_result)) void* jv_mem_realloc(void*, size_t);

#endif