2 * Copyright (c) 2007, Novell Inc.
4 * This program is licensed under the BSD license, read LICENSE.BSD
5 * for further information
13 #ifndef LIBSOLV_TOOLS_UTIL_H
14 #define LIBSOLV_TOOLS_UTIL_H
16 static char *_join_tmp;
17 static int _join_tmpl;
19 struct parsedata_common {
27 makeevr(Pool *pool, const char *s)
29 if (!strncmp(s, "0:", 2) && s[2])
31 return pool_str2id(pool, s, 1);
39 split(char *l, char **sp, int m)
49 while (*l && *l != ' ')
59 /* this join does not depend on parsedata */
61 join2(const char *s1, const char *s2, const char *s3)
76 _join_tmp = malloc(_join_tmpl);
78 _join_tmp = realloc(_join_tmp, _join_tmpl);
109 /* util function to set a translated string */
110 static inline void repodata_set_tstr(Repodata *data, Id handle, const char *attrname, const char *lang, const char *str)
113 attrid = pool_str2id(data->repo->pool, join2(attrname, ":", lang), 1);
114 repodata_set_str(data, handle, attrid, str);
117 #endif /* LIBSOLV_TOOLS_UTIL_H */