- clean up function names for shared library
authorMichael Schroeder <mls@suse.de>
Mon, 2 May 2011 11:08:09 +0000 (13:08 +0200)
committerMichael Schroeder <mls@suse.de>
Mon, 2 May 2011 11:08:09 +0000 (13:08 +0200)
src/bitmap.h
src/evr.c
src/evr.h
src/pool.h
src/poolid.c
src/poolid.h
src/solvable.c

index d9994c6..d5fa18e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Novell Inc.
+ * Copyright (c) 2007-2011, Novell Inc.
  *
  * This program is licensed under the BSD license, read LICENSE.BSD
  * for further information
 #ifndef SATSOLVER_BITMAP_H
 #define SATSOLVER_BITMAP_H
 
-#include <string.h>
-
 typedef struct _Map {
   unsigned char *map;
   int size;
 } Map;
 
 #define MAPZERO(m) (memset((m)->map, 0, (m)->size))
-#define MAPSET(m, n) ((m)->map[(n) >> 3] |= 1 << ((n) & 7)) // Set Bit
-#define MAPCLR(m, n) ((m)->map[(n) >> 3] &= ~(1 << ((n) & 7))) // Reset Bit
-#define MAPTST(m, n) ((m)->map[(n) >> 3] & (1 << ((n) & 7))) // Test Bit
-
-static inline void
-map_empty(Map *m)
-{
-  MAPZERO(m);
-}
+/* set bit */
+#define MAPSET(m, n) ((m)->map[(n) >> 3] |= 1 << ((n) & 7))
+/* clear bit */
+#define MAPCLR(m, n) ((m)->map[(n) >> 3] &= ~(1 << ((n) & 7)))
+/* test bit */
+#define MAPTST(m, n) ((m)->map[(n) >> 3] & (1 << ((n) & 7)))
 
 extern void map_init(Map *m, int n);
 extern void map_init_clone(Map *t, Map *s);
 extern void map_grow(Map *m, int n);
 extern void map_free(Map *m);
 
+static inline void map_empty(Map *m)
+{
+  MAPZERO(m);
+}
+static inline void map_set(Map *m, int n)
+{
+  MAPSET(m, n);
+}
+static inline void map_clr(Map *m, int n)
+{
+  MAPCLR(m, n);
+}
+static inline int map_tst(Map *m, int n)
+{
+  return MAPTST(m, n);
+}
+
 #endif /* SATSOLVER_BITMAP_H */
index 302c9c2..587cd5a 100644 (file)
--- a/src/evr.c
+++ b/src/evr.c
 #if defined(DEBIAN_SEMANTICS) || defined(MULTI_SEMANTICS)
 
 #ifdef MULTI_SEMANTICS
-# define vercmp vercmp_deb
+# define sat_vercmp sat_vercmp_deb
 #endif
 
 /* debian type version compare */
 int
-vercmp(const char *s1, const char *q1, const char *s2, const char *q2)
+sat_vercmp(const char *s1, const char *q1, const char *s2, const char *q2)
 {
   int r, c1, c2;
   while (1)
@@ -65,7 +65,7 @@ vercmp(const char *s1, const char *q1, const char *s2, const char *q2)
 }
 
 #ifdef MULTI_SEMANTICS
-# undef vercmp
+# undef sat_vercmp
 #endif
 
 #endif
@@ -76,7 +76,7 @@ vercmp(const char *s1, const char *q1, const char *s2, const char *q2)
 /* note: the code assumes that *q1 and *q2 are not alphanumeric! */
 
 int
-vercmp(const char *s1, const char *q1, const char *s2, const char *q2)
+sat_vercmp(const char *s1, const char *q1, const char *s2, const char *q2)
 {
   int r = 0;
   const char *e1, *e2;
@@ -135,12 +135,12 @@ vercmp(const char *s1, const char *q1, const char *s2, const char *q2)
 #endif
 
 #if defined(MULTI_SEMANTICS)
-# define vercmp (*(pool->disttype == DISTTYPE_DEB ? &vercmp_deb : &ver##cmp))
+# define sat_vercmp (*(pool->disttype == DISTTYPE_DEB ? &sat_vercmp_deb : &sat_ver##cmp))
 #endif
 
 /* edition (e:v-r) compare */
 int
-evrcmp_str(const Pool *pool, const char *evr1, const char *evr2, int mode)
+pool_evrcmp_str(const Pool *pool, const char *evr1, const char *evr2, int mode)
 {
   int r;
   const char *s1, *s2;
@@ -228,7 +228,7 @@ evrcmp_str(const Pool *pool, const char *evr1, const char *evr2, int mode)
 }
 
 int
-evrcmp(const Pool *pool, Id evr1id, Id evr2id, int mode)
+pool_evrcmp(const Pool *pool, Id evr1id, Id evr2id, int mode)
 {
   const char *evr1, *evr2;
   if (evr1id == evr2id)
@@ -239,7 +239,7 @@ evrcmp(const Pool *pool, Id evr1id, Id evr2id, int mode)
 }
 
 int
-evrmatch(const Pool *pool, Id evrid, const char *epoch, const char *version, const char *release)
+pool_evrmatch(const Pool *pool, Id evrid, const char *epoch, const char *version, const char *release)
 {
   const char *evr1;
   const char *s1;
@@ -286,4 +286,3 @@ evrmatch(const Pool *pool, Id evrid, const char *epoch, const char *version, con
   return 0;
 }
 
-// EOF
index e9a96f4..bdbf652 100644 (file)
--- a/src/evr.h
+++ b/src/evr.h
@@ -24,10 +24,29 @@ extern "C" {
 #define EVRCMP_MATCH                   2
 #define EVRCMP_COMPARE_EVONLY          3
 
-extern int vercmp(const char *s1, const char *q1, const char *s2, const char *q2);
-extern int evrcmp_str(const Pool *pool, const char *evr1, const char *evr2, int mode);
-extern int evrcmp(const Pool *pool, Id evr1id, Id evr2id, int mode);
-extern int evrmatch(const Pool *pool, Id evrid, const char *epoch, const char *version, const char *release);
+extern int sat_vercmp(const char *s1, const char *q1, const char *s2, const char *q2);
+
+extern int pool_evrcmp_str(const Pool *pool, const char *evr1, const char *evr2, int mode);
+extern int pool_evrcmp(const Pool *pool, Id evr1id, Id evr2id, int mode);
+extern int pool_evrmatch(const Pool *pool, Id evrid, const char *epoch, const char *version, const char *release);
+
+/* obsolete, do not use in new code */
+static inline int vercmp(const char *s1, const char *q1, const char *s2, const char *q2)
+{
+  return sat_vercmp(s1, q1, s2, q2);
+}
+static inline int evrcmp_str(const Pool *pool, const char *evr1, const char *evr2, int mode)
+{
+  return pool_evrcmp_str(pool, evr1, evr2, mode);
+}
+static inline int evrcmp(const Pool *pool, Id evr1id, Id evr2id, int mode)
+{
+  return pool_evrcmp(pool, evr1id, evr2id, mode);
+}
+static inline int evrmatch(const Pool *pool, Id evrid, const char *epoch, const char *version, const char *release)
+{
+  return pool_evrmatch(pool, evrid, epoch, version, release);
+}
 
 #ifdef __cplusplus
 }
index 81f0692..bd1639b 100644 (file)
@@ -219,10 +219,20 @@ static inline Solvable *pool_id2solvable(const Pool *pool, Id p)
   return pool->solvables + p;
 }
 
-extern const char *solvable2str(Pool *pool, Solvable *s);
+extern const char *pool_solvable2str(Pool *pool, Solvable *s);
+static inline const char *pool_solvid2str(Pool *pool, Id p)
+{
+  return pool_solvable2str(pool, pool->solvables + p);
+}
+
+/* obsolete, do not use anymore */
+static inline const char *solvable2str(Pool *pool, Solvable *s)
+{
+  return pool_solvable2str(pool, s);
+}
 static inline const char *solvid2str(Pool *pool, Id p)
 {
-  return solvable2str(pool, pool->solvables + p);
+  return pool_solvable2str(pool, pool->solvables + p);
 }
 
 void pool_set_languages(Pool *pool, const char **languages, int nlanguages);
index 05ba9ea..25b89a2 100644 (file)
@@ -24,7 +24,7 @@
 /* intern string into pool, return id */
 
 Id
-str2id(Pool *pool, const char *str, int create)
+pool_str2id(Pool *pool, const char *str, int create)
 {
   int oldnstrings = pool->ss.nstrings;
   Id id = stringpool_str2id(&pool->ss, str, create);
@@ -38,7 +38,7 @@ str2id(Pool *pool, const char *str, int create)
 }
 
 Id
-strn2id(Pool *pool, const char *str, unsigned int len, int create)
+pool_strn2id(Pool *pool, const char *str, unsigned int len, int create)
 {
   int oldnstrings = pool->ss.nstrings;
   Id id = stringpool_strn2id(&pool->ss, str, len, create);
@@ -52,7 +52,7 @@ strn2id(Pool *pool, const char *str, unsigned int len, int create)
 }
 
 Id
-rel2id(Pool *pool, Id name, Id evr, int flags, int create)
+pool_rel2id(Pool *pool, Id name, Id evr, int flags, int create)
 {
   Hashval h;
   unsigned int hh;
@@ -121,7 +121,7 @@ rel2id(Pool *pool, Id name, Id evr, int flags, int create)
 // for rels (returns name only) and strings
 // 
 const char *
-id2str(const Pool *pool, Id id)
+pool_id2str(const Pool *pool, Id id)
 {
   if (ISRELDEP(id))
     {
@@ -155,7 +155,7 @@ static const char *rels[] = {
 
 // get operator for RelId
 const char *
-id2rel(const Pool *pool, Id id)
+pool_id2rel(const Pool *pool, Id id)
 {
   Reldep *rd;
   if (!ISRELDEP(id))
@@ -188,7 +188,7 @@ id2rel(const Pool *pool, Id id)
 // get e:v.r for Id
 // 
 const char *
-id2evr(const Pool *pool, Id id)
+pool_id2evr(const Pool *pool, Id id)
 {
   Reldep *rd;
   if (!ISRELDEP(id))
@@ -256,7 +256,7 @@ dep2strcpy(const Pool *pool, char *p, Id id, int oldrel)
 }
 
 const char *
-dep2str(Pool *pool, Id id)
+pool_dep2str(Pool *pool, Id id)
 {
   char *p;
   if (!ISRELDEP(id))
index 698f7a7..dc4913e 100644 (file)
@@ -16,8 +16,9 @@
 #include "pooltypes.h"
 #include "hash.h"
 
-//-----------------------------------------------
-// Id's with relation
+/*-----------------------------------------------
+ * Ids with relation
+ */
 
 typedef struct _Reldep {
   Id name;             // "package"
@@ -25,16 +26,47 @@ typedef struct _Reldep {
   int flags;           // operation/relation, see REL_x in pool.h
 } Reldep;
 
-extern Id str2id(Pool *pool, const char *, int);
-extern Id strn2id(Pool *pool, const char *, unsigned int, int);
-extern Id rel2id(Pool *pool, Id, Id, int, int);
-extern const char *id2str(const Pool *pool, Id);
-extern const char *dep2str(Pool *pool, Id); /* might alloc tmpspace */
-extern const char *id2rel(const Pool *pool, Id);
-extern const char *id2evr(const Pool *pool, Id);
+extern Id pool_str2id(Pool *pool, const char *, int);
+extern Id pool_strn2id(Pool *pool, const char *, unsigned int, int);
+extern Id pool_rel2id(Pool *pool, Id, Id, int, int);
+extern const char *pool_id2str(const Pool *pool, Id);
+extern const char *pool_id2rel(const Pool *pool, Id);
+extern const char *pool_id2evr(const Pool *pool, Id);
+extern const char *pool_dep2str(Pool *pool, Id); /* might alloc tmpspace */
 
 extern void pool_shrink_strings(Pool *pool);
 extern void pool_shrink_rels(Pool *pool);
 extern void pool_freeidhashes(Pool *pool);
 
+
+/* deprecated names, do not use in new code */
+static inline Id str2id(Pool *pool, const char *str, int create)
+{
+  return pool_str2id(pool, str, create);
+}
+static inline Id strn2id(Pool *pool, const char *str, unsigned int len, int create)
+{
+  return pool_strn2id(pool, str, len, create);
+}
+static inline Id rel2id(Pool *pool, Id name, Id evr, int flags, int create)
+{
+  return pool_rel2id(pool, name, evr, flags, create);
+}
+static inline const char *id2str(const Pool *pool, Id id)
+{
+  return pool_id2str(pool, id);
+}
+static inline const char *id2rel(const Pool *pool, Id id)
+{
+  return pool_id2rel(pool, id);
+}
+static inline const char *id2evr(const Pool *pool, Id id)
+{
+  return pool_id2evr(pool, id);
+}
+static inline const char *dep2str(Pool *pool, Id id)
+{
+  return pool_dep2str(pool, id);
+}
+
 #endif /* SATSOLVER_POOLID_H */
index 1331331..a039836 100644 (file)
@@ -23,7 +23,7 @@
 #include "chksum.h"
 
 const char *
-solvable2str(Pool *pool, Solvable *s)
+pool_solvable2str(Pool *pool, Solvable *s)
 {
   const char *n, *e, *a;
   char *p;