The following commit has been merged in the master branch:
commit 9f148a4e9b2ea7fa45431f640051e66801161f25
Author: Guillem Jover <[EMAIL PROTECTED]>
Date:   Mon May 12 06:15:24 2008 +0300

    libdpkg: Add new rtrim_slash_slashdot private function

diff --git a/ChangeLog b/ChangeLog
index 5f3fdd5..4389f4f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-05-12  Guillem Jover  <[EMAIL PROTECTED]>
+
+       * lib/Makefile.am (libdpkg_a_SOURCES): Add 'dpkg-priv.h' and 'path.c'.
+       * lib/dpkg-priv.h: New file.
+       * lib/path.c: Likewise.
+
 2008-05-11  Pierre Habouzit  <[EMAIL PROTECTED]>
 
        * lib/showpkg.c (show1package): Use %zd instead of %d in sprintf()
diff --git a/lib/Makefile.am b/lib/Makefile.am
index e114041..b9b9d1c 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -15,6 +15,7 @@ libdpkg_a_SOURCES = \
        dpkg-def.h \
        dpkg.h \
        dpkg-db.h \
+       dpkg-priv.h \
        dlist.h \
        cleanup.c \
        compat.c \
@@ -35,6 +36,7 @@ libdpkg_a_SOURCES = \
        parse.c \
        parsehelp.c \
        parsedump.h \
+       path.c \
        showpkg.c \
        tarfn.c tarfn.h \
        triglib.c \
diff --git a/lib/dpkg-def.h b/lib/dpkg-priv.h
similarity index 60%
copy from lib/dpkg-def.h
copy to lib/dpkg-priv.h
index 08e01cb..26e1d84 100644
--- a/lib/dpkg-def.h
+++ b/lib/dpkg-priv.h
@@ -1,8 +1,8 @@
 /*
  * libdpkg - Debian packaging suite library routines
- * dpkg-def.h - C language support definitions
+ * dpkg-priv.h - private declarations for libdpkg and dpkg programs
  *
- * Copyright (C) 1994,1995 Ian Jackson <[EMAIL PROTECTED]>
+ * Copyright (C) 2008 Guillem Jover <[EMAIL PROTECTED]>
  *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as
@@ -19,21 +19,20 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#ifndef DPKG_DEF_H
-#define DPKG_DEF_H
+#ifndef DPKG_PRIV_H
+#define DPKG_PRIV_H
 
-#include <config.h>
-
-#if HAVE_C_ATTRIBUTE
-# define CONSTANT __attribute__((constant))
-# define PRINTFFORMAT(si, tc) __attribute__((format(printf,si,tc)))
-# define NONRETURNING __attribute__((noreturn))
-# define UNUSED __attribute__((unused))
-#else
-# define CONSTANT
-# define PRINTFFORMAT(si, tc)
-# define NONRETURNING
-# define UNUSED
+#ifdef __cplusplus
+extern "C" {
 #endif
 
+/* Path handling. */
+
+void rtrim_slash_slashdot(char *path);
+
+#ifdef __cplusplus
+}
 #endif
+
+#endif /* DPKG_PRIV_H */
+
diff --git a/lib/dpkg-def.h b/lib/path.c
similarity index 60%
copy from lib/dpkg-def.h
copy to lib/path.c
index 08e01cb..e9b47dd 100644
--- a/lib/dpkg-def.h
+++ b/lib/path.c
@@ -1,8 +1,8 @@
 /*
  * libdpkg - Debian packaging suite library routines
- * dpkg-def.h - C language support definitions
+ * path.c - path handling functions
  *
- * Copyright (C) 1994,1995 Ian Jackson <[EMAIL PROTECTED]>
+ * Copyright (C) 2008 Guillem Jover <[EMAIL PROTECTED]>
  *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as
@@ -19,21 +19,23 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#ifndef DPKG_DEF_H
-#define DPKG_DEF_H
-
 #include <config.h>
+#include <string.h>
+#include <dpkg-priv.h>
+
+void
+rtrim_slash_slashdot(char *path)
+{
+       char *end;
+
+       if (!path || !*path)
+               return;
 
-#if HAVE_C_ATTRIBUTE
-# define CONSTANT __attribute__((constant))
-# define PRINTFFORMAT(si, tc) __attribute__((format(printf,si,tc)))
-# define NONRETURNING __attribute__((noreturn))
-# define UNUSED __attribute__((unused))
-#else
-# define CONSTANT
-# define PRINTFFORMAT(si, tc)
-# define NONRETURNING
-# define UNUSED
-#endif
+       for (end = path + strlen(path) - 1; end - path >= 1; end--) {
+               if (*end == '/' || (*(end - 1) == '/' && *end == '.'))
+                       *end = '\0';
+               else
+                       break;
+       }
+}
 
-#endif

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to