diff options
Diffstat (limited to 'revdep/utility.h')
-rw-r--r-- | revdep/utility.h | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/revdep/utility.h b/revdep/utility.h index 34c02b1..b79484e 100644 --- a/revdep/utility.h +++ b/revdep/utility.h @@ -1,4 +1,4 @@ -// Copyright (C) 2015 James Buren +// Copyright (C) 2016 James Buren // // This file is part of revdep. // @@ -17,27 +17,12 @@ #pragma once -#define new(T,N) ((T*)xmalloc(sizeof(T)*(N))) -#define renew(P,T,N) ((T*)xrealloc((P),sizeof(T)*(N))) +#include <vector> +#include <string> -typedef void (*parse_cb_t) (int record, int field, char *start, char *end); +typedef std::vector <std::string> StringVector; -enum -{ - LOG_BRIEF, - LOG_INFO_1, - LOG_INFO_2, - LOG_ERROR, - LOG_DEBUG -}; - -extern void *xmalloc(unsigned int bytes); -extern void *xrealloc(void *p, unsigned int bytes); -extern char *xstrdup(const char *in); -extern void logger(int level, const char *fmt, ...) __attribute__((format(printf,2,3))); -extern char *strtrim(char *s); -extern unsigned int string_crc32(const char *s); -extern int open_file_in_memory(const char *path, char **text, unsigned int *length); -extern void close_file_in_memory(char *text, unsigned int length); -extern int parse_file_in_memory(char *text, parse_cb_t cb); -extern int get_ld_for_file(const char *pkg, const char *path, const char **ld); +void split(const std::string &in, StringVector &out, char delimiter); +void ReadRdConf(const std::string &path, StringVector &dirs); +bool ReadLdConf(const std::string &path, StringVector &dirs, int maxDepth); +bool IsFile(const std::string &path); |