From: Tomas Mlcoch Date: Mon, 6 May 2013 10:05:33 +0000 (+0200) Subject: cr_safe_string_chunk_insert moved from parsehdr into the misc module. X-Git-Tag: upstream/0.2.1~222 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5586706f58903634e885c0592a4dab6da88a1dd8;p=services%2Fcreaterepo_c.git cr_safe_string_chunk_insert moved from parsehdr into the misc module. --- diff --git a/src/misc.h b/src/misc.h index 6791093..ee6b486 100644 --- a/src/misc.h +++ b/src/misc.h @@ -254,17 +254,31 @@ void cr_nvrea_free(struct cr_NVREA *nvrea); (B)->epoch, (B)->version, (B)->release)) /** Compare two version strings splited into evr chunks. - * param e1 1. epoch - * param v1 1. version - * param r1 1. release - * param e2 2. epoch - * param v2 2. version - * param r2 2. release - * return 0 = same, 1 = first is newer, -1 = second is newer + * @param e1 1. epoch + * @param v1 1. version + * @param r1 1. release + * @param e2 2. epoch + * @param v2 2. version + * @param r2 2. release + * @return 0 = same, 1 = first is newer, -1 = second is newer */ int cr_cmp_evr(const char *e1, const char *v1, const char *r1, const char *e2, const char *v2, const char *r2); + +/** Safe insert into GStringChunk. + * @param chunk a GStringChunk + * @param str string to add or NULL + * @return pointer to the copy of str or NULL if str is NULL + */ +static inline gchar * +cr_safe_string_chunk_insert(GStringChunk *chunk, const char *str) +{ + if (!str) return NULL; + return g_string_chunk_insert(chunk, str); +} + + /** @} */ #ifdef __cplusplus diff --git a/src/parsehdr.c b/src/parsehdr.c index 447acde..1955007 100644 --- a/src/parsehdr.c +++ b/src/parsehdr.c @@ -27,17 +27,6 @@ #include "misc.h" -static inline gchar * -cr_safe_string_chunk_insert(GStringChunk *chunk, const char *str) -{ - if (!chunk || !str) { - return NULL; - } - - return g_string_chunk_insert(chunk, str); -} - - static inline int cr_compare_dependency(const char *dep1, const char *dep2) {