aboutsummaryrefslogtreecommitdiff
path: root/src/benchmarks/espresso/utility.h
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fl.fischer@fau.de>2020-05-06 16:56:32 +0200
committerFlorian Fischer <florian.fl.fischer@fau.de>2020-06-02 11:18:47 +0200
commit8174a918ea3b7cb216bf7ea98cfdc10661b5c37d (patch)
tree0747ec3ccb9f8d7eeccfac35977fc17855ca3bbb /src/benchmarks/espresso/utility.h
parent8f52e8fc02dd235582f5961941bcd564e9a681cd (diff)
downloadallocbench-8174a918ea3b7cb216bf7ea98cfdc10661b5c37d.tar.gz
allocbench-8174a918ea3b7cb216bf7ea98cfdc10661b5c37d.zip
make the whole project more python idiomatic
* rename src directory to allocbench * make global variable names UPPERCASE * format a lot of code using yapf * use lowercase ld_preload and ld_library_path as Allocator members * name expected Errors 'err' and don't raise a new Exception * disable some pylint messages
Diffstat (limited to 'src/benchmarks/espresso/utility.h')
-rw-r--r--src/benchmarks/espresso/utility.h93
1 files changed, 0 insertions, 93 deletions
diff --git a/src/benchmarks/espresso/utility.h b/src/benchmarks/espresso/utility.h
deleted file mode 100644
index dcb834e..0000000
--- a/src/benchmarks/espresso/utility.h
+++ /dev/null
@@ -1,93 +0,0 @@
-#ifndef UTILITY_H
-#define UTILITY_H
-
-#include <stdlib.h>
-#include <string.h>
-//#include <stdbool.h>
-
-/*
- * assumes the memory manager is libmm.a
- * - allows malloc(0) or realloc(obj, 0)
- * - catches out of memory (and calls MMout_of_memory())
- * - catch free(0) and realloc(0, size) in the macros
- */
-#define NIL(type) ((type *) 0)
-
-#ifdef BWGC
-#define ALLOC(type, num) \
- ((type *) gc_malloc(sizeof(type) * ((num)==0?1:(num))))
-#define REALLOC(type, obj, num) \
- (obj) ? ((type *) gc_realloc((char *) obj, sizeof(type) * ((num)==0?1:(num)))) : \
- ((type *) gc_malloc(sizeof(type) * ((num)==0?1:(num))))
-#elif defined(CUSTOM_MALLOC)
-#define ALLOC(type, num) \
- ((type *) CUSTOM_MALLOC(sizeof(type) * (num)))
-#define REALLOC(type, obj, num) \
- (obj) ? ((type *) CUSTOM_REALLOC((char *) obj, sizeof(type) * (num))) : \
- ((type *) CUSTOM_MALLOC(sizeof(type) * (num)))
-#else
-#include <stdlib.h>
-#define ALLOC(type, num) \
- ((type *) malloc(sizeof(type) * (num)))
-#define REALLOC(type, obj, num) \
- (obj) ? ((type *) realloc((char *) obj, sizeof(type) * (num))) : \
- ((type *) malloc(sizeof(type) * (num)))
-#endif
-
-#ifdef IGNOREFREE
-#define FREE(obj) \
- {};
-#elif defined(CUSTOM_FREE)
-#define FREE(obj) \
- if ((obj)) { (void) CUSTOM_FREE((char *) (obj)); (obj) = 0; }
-#else
-#define FREE(obj) \
- if ((obj)) { (void) free((char *) (obj)); (obj) = 0; }
-#endif
-
-#include "ansi.h"
-
-EXTERN long util_cpu_time
- NULLARGS;
-EXTERN char *util_path_search
- ARGS((char *program));
-EXTERN char *util_file_search
- ARGS((char *file, char *path, char *mode));
-EXTERN int util_pipefork
- ARGS((char **argv, FILE **toCommand, FILE **fromCommand, int *pid));
-EXTERN int util_csystem
- ARGS((char *command));
-EXTERN char *util_print_time
- ARGS((long t));
-EXTERN char *util_strsav
- ARGS((char *ptr));
-EXTERN char *util_tilde_expand
- ARGS((char *filename));
-EXTERN char *util_tilde_compress
- ARGS((char *filename));
-EXTERN void util_register_user
- ARGS((char *user, char *directory));
-
-#ifndef NIL_FN
-#define NIL_FN(type) ((type (*)()) 0)
-#endif /* NIL_FN */
-
-#ifndef MAX
-#define MAX(a,b) ((a) > (b) ? (a) : (b))
-#endif /* MAX */
-#ifndef MIN
-#define MIN(a,b) ((a) < (b) ? (a) : (b))
-#endif /* MIN */
-#ifndef ABS
-#define ABS(a) ((a) > 0 ? (a) : -(a))
-#endif /* ABS */
-
-
-#ifdef lint
-#undef ALLOC /* allow for lint -h flag */
-#undef REALLOC
-#define ALLOC(type, num) (((type *) 0) + (num))
-#define REALLOC(type, obj, num) ((obj) + (num))
-#endif /* lint */
-
-#endif