diff options
author | Denys Vlasenko <dvlasenk@redhat.com> | 2010-12-08 16:07:31 +0100 |
---|---|---|
committer | Denys Vlasenko <dvlasenk@redhat.com> | 2010-12-08 16:07:31 +0100 |
commit | dc3c5b79ba1ee6fd7a98842fde43d072e004f93b (patch) | |
tree | 131a23c0e5ac6c6be1f23872753ac1ae62e7f7fa /src/lib | |
parent | cba369350c57dc763814376ac4cba8a011962fc7 (diff) | |
download | abrt-dc3c5b79ba1ee6fd7a98842fde43d072e004f93b.tar.gz abrt-dc3c5b79ba1ee6fd7a98842fde43d072e004f93b.tar.xz abrt-dc3c5b79ba1ee6fd7a98842fde43d072e004f93b.zip |
add abrt_ prefixes to abrt-internal functions in libabrt.so
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/hash_md5.h | 3 | ||||
-rw-r--r-- | src/lib/hash_sha1.h | 3 | ||||
-rw-r--r-- | src/lib/hooklib.h | 8 | ||||
-rw-r--r-- | src/lib/logging.h | 29 | ||||
-rw-r--r-- | src/lib/parse_options.h | 2 | ||||
-rw-r--r-- | src/lib/read_write.h | 6 | ||||
-rw-r--r-- | src/lib/strbuf.c | 2 | ||||
-rw-r--r-- | src/lib/strbuf.h | 11 | ||||
-rw-r--r-- | src/lib/xatonum.c | 4 | ||||
-rw-r--r-- | src/lib/xfuncs.c | 10 |
10 files changed, 55 insertions, 23 deletions
diff --git a/src/lib/hash_md5.h b/src/lib/hash_md5.h index cc1d2c43..f7e9f398 100644 --- a/src/lib/hash_md5.h +++ b/src/lib/hash_md5.h @@ -24,6 +24,9 @@ typedef struct md5_ctx_t { uint32_t buflen; char buffer[128]; } md5_ctx_t; +#define md5_begin abrt_md5_begin void md5_begin(md5_ctx_t *ctx); +#define md5_hash abrt_md5_hash void md5_hash(const void *data, size_t length, md5_ctx_t *ctx); +#define md5_end abrt_md5_end void md5_end(void *resbuf, md5_ctx_t *ctx); diff --git a/src/lib/hash_sha1.h b/src/lib/hash_sha1.h index 02978ea4..09f50d12 100644 --- a/src/lib/hash_sha1.h +++ b/src/lib/hash_sha1.h @@ -31,8 +31,11 @@ typedef struct sha1_ctx_t { void (*process_block)(struct sha1_ctx_t*); } sha1_ctx_t; +#define sha1_begin abrt_sha1_begin void sha1_begin(sha1_ctx_t *ctx); +#define sha1_hash abrt_sha1_hash void sha1_hash(const void *buffer, size_t len, sha1_ctx_t *ctx); +#define sha1_end abrt_sha1_end void sha1_end(void *resbuf, sha1_ctx_t *ctx); #ifdef __cplusplus diff --git a/src/lib/hooklib.h b/src/lib/hooklib.h index ba76efbc..84b31a5f 100644 --- a/src/lib/hooklib.h +++ b/src/lib/hooklib.h @@ -20,8 +20,14 @@ extern "C" { #endif -void parse_conf(const char *additional_conf, unsigned *setting_MaxCrashReportsSize, bool *setting_MakeCompatCore, bool *setting_SaveBinaryImage); +#define parse_conf abrt_parse_conf +void parse_conf(const char *additional_conf, + unsigned *setting_MaxCrashReportsSize, + bool *setting_MakeCompatCore, + bool *setting_SaveBinaryImage); +#define check_free_space abrt_check_free_space void check_free_space(unsigned setting_MaxCrashReportsSize); +#define trim_debug_dumps abrt_trim_debug_dumps void trim_debug_dumps(unsigned setting_MaxCrashReportsSize, const char *exclude_path); #ifdef __cplusplus diff --git a/src/lib/logging.h b/src/lib/logging.h index 8a038bc7..316c1a22 100644 --- a/src/lib/logging.h +++ b/src/lib/logging.h @@ -33,14 +33,6 @@ extern "C" { #define NORETURN __attribute__ ((noreturn)) -/* VERB1 log("what you sometimes want to see, even on a production box") */ -#define VERB1 if (g_verbose >= 1) -/* VERB2 log("debug message, not going into insanely small details") */ -#define VERB2 if (g_verbose >= 2) -/* VERB3 log("lots and lots of details") */ -#define VERB3 if (g_verbose >= 3) -/* there is no level > 3 */ - enum { LOGMODE_NONE = 0, LOGMODE_STDIO = (1 << 0), @@ -49,26 +41,47 @@ enum { LOGMODE_CUSTOM = (1 << 2), }; +#define g_custom_logger abrt_g_custom_logger extern void (*g_custom_logger)(const char*); +#define msg_prefix abrt_msg_prefix extern const char *msg_prefix; +#define msg_eol abrt_msg_eol extern const char *msg_eol; +#define logmode abrt_logmode extern int logmode; +#define xfunc_error_retval abrt_xfunc_error_retval extern int xfunc_error_retval; /* Verbosity level */ +#define g_verbose abrt_g_verbose extern int g_verbose; +/* VERB1 log("what you sometimes want to see, even on a production box") */ +#define VERB1 if (g_verbose >= 1) +/* VERB2 log("debug message, not going into insanely small details") */ +#define VERB2 if (g_verbose >= 2) +/* VERB3 log("lots and lots of details") */ +#define VERB3 if (g_verbose >= 3) +/* there is no level > 3 */ +#define abrt_ +#define xfunc_die abrt_xfunc_die void xfunc_die(void) NORETURN; +#define log_msg abrt_log_msg void log_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); /* It's a macro, not function, since it collides with log() from math.h */ #undef log #define log(...) log_msg(__VA_ARGS__) /* error_msg family will use g_custom_logger. log_msg does not. */ +#define error_msg abrt_error_msg void error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); +#define error_msg_and_die abrt_error_msg_and_die void error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); /* Reports error message with libc's errno error description attached. */ +#define perror_msg abrt_perror_msg void perror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); +#define perror_msg_and_die abrt_perror_msg_and_die void perror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); +#define die_out_of_memory abrt_die_out_of_memory void die_out_of_memory(void) NORETURN; #ifdef __cplusplus diff --git a/src/lib/parse_options.h b/src/lib/parse_options.h index 105f081c..98138063 100644 --- a/src/lib/parse_options.h +++ b/src/lib/parse_options.h @@ -41,9 +41,11 @@ struct options { #define OPT__VERBOSE(v) OPT_BOOL('v', "verbose", (v), "be verbose") +#define parse_opts abrt_parse_opts unsigned parse_opts(int argc, char **argv, const struct options *opt, const char *usage); +#define parse_usage_and_die abrt_parse_usage_and_die void parse_usage_and_die(const char *usage, const struct options *opt); #ifdef __cplusplus diff --git a/src/lib/read_write.h b/src/lib/read_write.h index 054a1a9a..dc85f33b 100644 --- a/src/lib/read_write.h +++ b/src/lib/read_write.h @@ -32,14 +32,20 @@ extern "C" { // NB: will return short read on error, not -1, // if some data was read before error occurred +#define xread abrt_xread void xread(int fd, void *buf, size_t count); +#define safe_read abrt_safe_read ssize_t safe_read(int fd, void *buf, size_t count); +#define safe_write abrt_safe_write ssize_t safe_write(int fd, const void *buf, size_t count); +#define full_read abrt_full_read ssize_t full_read(int fd, void *buf, size_t count); +#define full_write abrt_full_write ssize_t full_write(int fd, const void *buf, size_t count); +#define full_write_str abrt_full_write_str ssize_t full_write_str(int fd, const char *buf); #ifdef __cplusplus diff --git a/src/lib/strbuf.c b/src/lib/strbuf.c index 04a35998..f56815a0 100644 --- a/src/lib/strbuf.c +++ b/src/lib/strbuf.c @@ -37,7 +37,7 @@ int suffixcmp(const char *str, const char *suffix) return strcmp(str + len_minus_suflen, suffix); } -struct strbuf *strbuf_new() +struct strbuf *strbuf_new(void) { struct strbuf *buf = xzalloc(sizeof(*buf)); /*buf->len = 0; - done by xzalloc */ diff --git a/src/lib/strbuf.h b/src/lib/strbuf.h index dc45a199..44c6599a 100644 --- a/src/lib/strbuf.h +++ b/src/lib/strbuf.h @@ -39,13 +39,15 @@ struct strbuf * It never returns NULL. The returned pointer must be released by * calling the function strbuf_free(). */ -struct strbuf *strbuf_new(); +#define strbuf_new abrt_strbuf_new +struct strbuf *strbuf_new(void); /** * Releases the memory held by the string buffer. * @param strbuf * If the strbuf is NULL, no operation is performed. */ +#define strbuf_free abrt_strbuf_free void strbuf_free(struct strbuf *strbuf); /** @@ -53,24 +55,28 @@ void strbuf_free(struct strbuf *strbuf); * string buffer is returned. Caller is responsible to release the * returned memory using free(). */ +#define strbuf_free_nobuf abrt_strbuf_free_nobuf char* strbuf_free_nobuf(struct strbuf *strbuf); /** * The string content is set to an empty string, erasing any previous * content and leaving its length at 0 characters. */ +#define strbuf_clear abrt_strbuf_clear void strbuf_clear(struct strbuf *strbuf); /** * The current content of the string buffer is extended by adding a * character c at its end. */ +#define strbuf_append_char abrt_strbuf_append_char struct strbuf *strbuf_append_char(struct strbuf *strbuf, char c); /** * The current content of the string buffer is extended by adding a * string str at its end. */ +#define strbuf_append_str abrt_strbuf_append_str struct strbuf *strbuf_append_str(struct strbuf *strbuf, const char *str); @@ -78,6 +84,7 @@ struct strbuf *strbuf_append_str(struct strbuf *strbuf, * The current content of the string buffer is extended by inserting a * string str at its beginning. */ +#define strbuf_prepend_str abrt_strbuf_prepend_str struct strbuf *strbuf_prepend_str(struct strbuf *strbuf, const char *str); @@ -85,6 +92,7 @@ struct strbuf *strbuf_prepend_str(struct strbuf *strbuf, * The current content of the string buffer is extended by adding a * sequence of data formatted as the format argument specifies. */ +#define strbuf_append_strf abrt_strbuf_append_strf struct strbuf *strbuf_append_strf(struct strbuf *strbuf, const char *format, ...); @@ -93,6 +101,7 @@ struct strbuf *strbuf_append_strf(struct strbuf *strbuf, * sequence of data formatted as the format argument specifies at the * buffer beginning. */ +#define strbuf_prepend_strf abrt_strbuf_prepend_strf struct strbuf *strbuf_prepend_strf(struct strbuf *strbuf, const char *format, ...); diff --git a/src/lib/xatonum.c b/src/lib/xatonum.c index 3b22071f..1a92db7f 100644 --- a/src/lib/xatonum.c +++ b/src/lib/xatonum.c @@ -28,7 +28,7 @@ inval: error_msg_and_die("invalid number '%s'", numstr); } -int xatoi_u(const char *numstr) +int xatoi_positive(const char *numstr) { unsigned r = xatou(numstr); if (r > (unsigned)INT_MAX) @@ -41,7 +41,7 @@ int xatoi(const char *numstr) unsigned r; if (*numstr != '-') - return xatoi_u(numstr); + return xatoi_positive(numstr); r = xatou(numstr + 1); if (r > (unsigned)INT_MAX + 1) diff --git a/src/lib/xfuncs.c b/src/lib/xfuncs.c index d5166037..71796371 100644 --- a/src/lib/xfuncs.c +++ b/src/lib/xfuncs.c @@ -39,16 +39,6 @@ int close_on_exec_on(int fd) return fcntl(fd, F_SETFD, FD_CLOEXEC); } -#if 0 /* unused */ -void *xcalloc(size_t nmemb, size_t size) -{ - void *ptr = calloc(nmemb, size); - if (!ptr && nmemb && size) - die_out_of_memory(); - return ptr; -} -#endif - // Die if we can't allocate size bytes of memory. void* xmalloc(size_t size) { |