diff options
Diffstat (limited to 'tools/perf/util/util.h')
| -rw-r--r-- | tools/perf/util/util.h | 154 |
1 files changed, 0 insertions, 154 deletions
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h index 0795bf304b19..52118a0c0bad 100644 --- a/tools/perf/util/util.h +++ b/tools/perf/util/util.h | |||
| @@ -152,7 +152,6 @@ extern void warning(const char *err, ...) __attribute__((format (printf, 1, 2))) | |||
| 152 | extern void set_die_routine(void (*routine)(const char *err, va_list params) NORETURN); | 152 | extern void set_die_routine(void (*routine)(const char *err, va_list params) NORETURN); |
| 153 | 153 | ||
| 154 | extern int prefixcmp(const char *str, const char *prefix); | 154 | extern int prefixcmp(const char *str, const char *prefix); |
| 155 | extern time_t tm_to_time_t(const struct tm *tm); | ||
| 156 | 155 | ||
| 157 | static inline const char *skip_prefix(const char *str, const char *prefix) | 156 | static inline const char *skip_prefix(const char *str, const char *prefix) |
| 158 | { | 157 | { |
| @@ -160,119 +159,6 @@ static inline const char *skip_prefix(const char *str, const char *prefix) | |||
| 160 | return strncmp(str, prefix, len) ? NULL : str + len; | 159 | return strncmp(str, prefix, len) ? NULL : str + len; |
| 161 | } | 160 | } |
| 162 | 161 | ||
| 163 | #if defined(NO_MMAP) || defined(USE_WIN32_MMAP) | ||
| 164 | |||
| 165 | #ifndef PROT_READ | ||
| 166 | #define PROT_READ 1 | ||
| 167 | #define PROT_WRITE 2 | ||
| 168 | #define MAP_PRIVATE 1 | ||
| 169 | #define MAP_FAILED ((void*)-1) | ||
| 170 | #endif | ||
| 171 | |||
| 172 | #define mmap git_mmap | ||
| 173 | #define munmap git_munmap | ||
| 174 | extern void *git_mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset); | ||
| 175 | extern int git_munmap(void *start, size_t length); | ||
| 176 | |||
| 177 | #else /* NO_MMAP || USE_WIN32_MMAP */ | ||
| 178 | |||
| 179 | #include <sys/mman.h> | ||
| 180 | |||
| 181 | #endif /* NO_MMAP || USE_WIN32_MMAP */ | ||
| 182 | |||
| 183 | #ifdef NO_MMAP | ||
| 184 | |||
| 185 | /* This value must be multiple of (pagesize * 2) */ | ||
| 186 | #define DEFAULT_PACKED_GIT_WINDOW_SIZE (1 * 1024 * 1024) | ||
| 187 | |||
| 188 | #else /* NO_MMAP */ | ||
| 189 | |||
| 190 | /* This value must be multiple of (pagesize * 2) */ | ||
| 191 | #define DEFAULT_PACKED_GIT_WINDOW_SIZE \ | ||
| 192 | (sizeof(void*) >= 8 \ | ||
| 193 | ? 1 * 1024 * 1024 * 1024 \ | ||
| 194 | : 32 * 1024 * 1024) | ||
| 195 | |||
| 196 | #endif /* NO_MMAP */ | ||
| 197 | |||
| 198 | #ifdef NO_ST_BLOCKS_IN_STRUCT_STAT | ||
| 199 | #define on_disk_bytes(st) ((st).st_size) | ||
| 200 | #else | ||
| 201 | #define on_disk_bytes(st) ((st).st_blocks * 512) | ||
| 202 | #endif | ||
| 203 | |||
| 204 | #define DEFAULT_PACKED_GIT_LIMIT \ | ||
| 205 | ((1024L * 1024L) * (sizeof(void*) >= 8 ? 8192 : 256)) | ||
| 206 | |||
| 207 | #ifdef NO_PREAD | ||
| 208 | #define pread git_pread | ||
| 209 | extern ssize_t git_pread(int fd, void *buf, size_t count, off_t offset); | ||
| 210 | #endif | ||
| 211 | /* | ||
| 212 | * Forward decl that will remind us if its twin in cache.h changes. | ||
| 213 | * This function is used in compat/pread.c. But we can't include | ||
| 214 | * cache.h there. | ||
| 215 | */ | ||
| 216 | extern ssize_t read_in_full(int fd, void *buf, size_t count); | ||
| 217 | |||
| 218 | #ifdef NO_SETENV | ||
| 219 | #define setenv gitsetenv | ||
| 220 | extern int gitsetenv(const char *, const char *, int); | ||
| 221 | #endif | ||
| 222 | |||
| 223 | #ifdef NO_MKDTEMP | ||
| 224 | #define mkdtemp gitmkdtemp | ||
| 225 | extern char *gitmkdtemp(char *); | ||
| 226 | #endif | ||
| 227 | |||
| 228 | #ifdef NO_UNSETENV | ||
| 229 | #define unsetenv gitunsetenv | ||
| 230 | extern void gitunsetenv(const char *); | ||
| 231 | #endif | ||
| 232 | |||
| 233 | #ifdef NO_STRCASESTR | ||
| 234 | #define strcasestr gitstrcasestr | ||
| 235 | extern char *gitstrcasestr(const char *haystack, const char *needle); | ||
| 236 | #endif | ||
| 237 | |||
| 238 | #ifdef NO_STRLCPY | ||
| 239 | #define strlcpy gitstrlcpy | ||
| 240 | extern size_t gitstrlcpy(char *, const char *, size_t); | ||
| 241 | #endif | ||
| 242 | |||
| 243 | #ifdef NO_STRTOUMAX | ||
| 244 | #define strtoumax gitstrtoumax | ||
| 245 | extern uintmax_t gitstrtoumax(const char *, char **, int); | ||
| 246 | #endif | ||
| 247 | |||
| 248 | #ifdef NO_HSTRERROR | ||
| 249 | #define hstrerror githstrerror | ||
| 250 | extern const char *githstrerror(int herror); | ||
| 251 | #endif | ||
| 252 | |||
| 253 | #ifdef NO_MEMMEM | ||
| 254 | #define memmem gitmemmem | ||
| 255 | void *gitmemmem(const void *haystack, size_t haystacklen, | ||
| 256 | const void *needle, size_t needlelen); | ||
| 257 | #endif | ||
| 258 | |||
| 259 | #ifdef FREAD_READS_DIRECTORIES | ||
| 260 | #ifdef fopen | ||
| 261 | #undef fopen | ||
| 262 | #endif | ||
| 263 | #define fopen(a,b) git_fopen(a,b) | ||
| 264 | extern FILE *git_fopen(const char*, const char*); | ||
| 265 | #endif | ||
| 266 | |||
| 267 | #ifdef SNPRINTF_RETURNS_BOGUS | ||
| 268 | #define snprintf git_snprintf | ||
| 269 | extern int git_snprintf(char *str, size_t maxsize, | ||
| 270 | const char *format, ...); | ||
| 271 | #define vsnprintf git_vsnprintf | ||
| 272 | extern int git_vsnprintf(char *str, size_t maxsize, | ||
| 273 | const char *format, va_list ap); | ||
| 274 | #endif | ||
| 275 | |||
| 276 | #ifdef __GLIBC_PREREQ | 162 | #ifdef __GLIBC_PREREQ |
| 277 | #if __GLIBC_PREREQ(2, 1) | 163 | #if __GLIBC_PREREQ(2, 1) |
| 278 | #define HAVE_STRCHRNUL | 164 | #define HAVE_STRCHRNUL |
| @@ -294,7 +180,6 @@ static inline char *gitstrchrnul(const char *s, int c) | |||
| 294 | */ | 180 | */ |
| 295 | extern char *xstrdup(const char *str); | 181 | extern char *xstrdup(const char *str); |
| 296 | extern void *xmalloc(size_t size) __attribute__((weak)); | 182 | extern void *xmalloc(size_t size) __attribute__((weak)); |
| 297 | extern void *xmemdupz(const void *data, size_t len); | ||
| 298 | extern char *xstrndup(const char *str, size_t len); | 183 | extern char *xstrndup(const char *str, size_t len); |
| 299 | extern void *xrealloc(void *ptr, size_t size) __attribute__((weak)); | 184 | extern void *xrealloc(void *ptr, size_t size) __attribute__((weak)); |
| 300 | 185 | ||
| @@ -310,11 +195,6 @@ static inline void *zalloc(size_t size) | |||
| 310 | return calloc(1, size); | 195 | return calloc(1, size); |
| 311 | } | 196 | } |
| 312 | 197 | ||
| 313 | static inline size_t xsize_t(off_t len) | ||
| 314 | { | ||
| 315 | return (size_t)len; | ||
| 316 | } | ||
| 317 | |||
| 318 | static inline int has_extension(const char *filename, const char *ext) | 198 | static inline int has_extension(const char *filename, const char *ext) |
| 319 | { | 199 | { |
| 320 | size_t len = strlen(filename); | 200 | size_t len = strlen(filename); |
| @@ -351,8 +231,6 @@ extern unsigned char sane_ctype[256]; | |||
| 351 | #define isalpha(x) sane_istest(x,GIT_ALPHA) | 231 | #define isalpha(x) sane_istest(x,GIT_ALPHA) |
| 352 | #define isalnum(x) sane_istest(x,GIT_ALPHA | GIT_DIGIT) | 232 | #define isalnum(x) sane_istest(x,GIT_ALPHA | GIT_DIGIT) |
| 353 | #define isprint(x) sane_istest(x,GIT_PRINT) | 233 | #define isprint(x) sane_istest(x,GIT_PRINT) |
| 354 | #define is_glob_special(x) sane_istest(x,GIT_GLOB_SPECIAL) | ||
| 355 | #define is_regex_special(x) sane_istest(x,GIT_GLOB_SPECIAL | GIT_REGEX_SPECIAL) | ||
| 356 | #define tolower(x) sane_case((unsigned char)(x), 0x20) | 234 | #define tolower(x) sane_case((unsigned char)(x), 0x20) |
| 357 | #define toupper(x) sane_case((unsigned char)(x), 0) | 235 | #define toupper(x) sane_case((unsigned char)(x), 0) |
| 358 | 236 | ||
| @@ -363,38 +241,6 @@ static inline int sane_case(int x, int high) | |||
| 363 | return x; | 241 | return x; |
| 364 | } | 242 | } |
| 365 | 243 | ||
| 366 | static inline int strtoul_ui(char const *s, int base, unsigned int *result) | ||
| 367 | { | ||
| 368 | unsigned long ul; | ||
| 369 | char *p; | ||
| 370 | |||
| 371 | errno = 0; | ||
| 372 | ul = strtoul(s, &p, base); | ||
| 373 | if (errno || *p || p == s || (unsigned int) ul != ul) | ||
| 374 | return -1; | ||
| 375 | *result = ul; | ||
| 376 | return 0; | ||
| 377 | } | ||
| 378 | |||
| 379 | static inline int strtol_i(char const *s, int base, int *result) | ||
| 380 | { | ||
| 381 | long ul; | ||
| 382 | char *p; | ||
| 383 | |||
| 384 | errno = 0; | ||
| 385 | ul = strtol(s, &p, base); | ||
| 386 | if (errno || *p || p == s || (int) ul != ul) | ||
| 387 | return -1; | ||
| 388 | *result = ul; | ||
| 389 | return 0; | ||
| 390 | } | ||
| 391 | |||
| 392 | #ifdef INTERNAL_QSORT | ||
| 393 | void git_qsort(void *base, size_t nmemb, size_t size, | ||
| 394 | int(*compar)(const void *, const void *)); | ||
| 395 | #define qsort git_qsort | ||
| 396 | #endif | ||
| 397 | |||
| 398 | #ifndef DIR_HAS_BSD_GROUP_SEMANTICS | 244 | #ifndef DIR_HAS_BSD_GROUP_SEMANTICS |
| 399 | # define FORCE_DIR_SET_GID S_ISGID | 245 | # define FORCE_DIR_SET_GID S_ISGID |
| 400 | #else | 246 | #else |
