[pacman-dev] [PATCH] inline libarchive compat wrappers

Dave Reisner dreisner at archlinux.org
Tue Jan 29 09:25:18 EST 2013


Suggested-by: Dan McGee <dan at archlinux.org>
Signed-off-by: Dave Reisner <dreisner at archlinux.org>
---
 lib/libalpm/Makefile.am                               |  2 +-
 .../{libarchive-compat.c => libarchive-compat.h}      | 19 +++++++++++--------
 2 files changed, 12 insertions(+), 9 deletions(-)
 rename lib/libalpm/{libarchive-compat.c => libarchive-compat.h} (76%)

diff --git a/lib/libalpm/Makefile.am b/lib/libalpm/Makefile.am
index 55fec9c..171bc46 100644
--- a/lib/libalpm/Makefile.am
+++ b/lib/libalpm/Makefile.am
@@ -44,7 +44,7 @@ libalpm_la_SOURCES = \
 	graph.h graph.c \
 	group.h group.c \
 	handle.h handle.c \
-	libarchive-compat.h libarchive-compat.c \
+	libarchive-compat.h \
 	log.h log.c \
 	package.h package.c \
 	pkghash.h pkghash.c \
diff --git a/lib/libalpm/libarchive-compat.c b/lib/libalpm/libarchive-compat.h
similarity index 76%
rename from lib/libalpm/libarchive-compat.c
rename to lib/libalpm/libarchive-compat.h
index 56af2e1..814d3b4 100644
--- a/lib/libalpm/libarchive-compat.c
+++ b/lib/libalpm/libarchive-compat.h
@@ -1,5 +1,8 @@
+#ifndef _LIBARCHIVE_COMPAT_H
+#define _LIBARCHIVE_COMPAT_H
+
 /*
- * libarchive-compat.c
+ * libarchive-compat.h
  *
  *  Copyright (c) 2013 Pacman Development Team <pacman-dev at archlinux.org>
  *
@@ -19,9 +22,7 @@
 
 #include <stdint.h>
 
-#include "libarchive-compat.h"
-
-int _alpm_archive_read_free(struct archive *archive) {
+static inline int _alpm_archive_read_free(struct archive *archive) {
 #if ARCHIVE_VERSION_NUMBER >= 3000000
 	return archive_read_free(archive);
 #else
@@ -29,7 +30,7 @@ int _alpm_archive_read_free(struct archive *archive) {
 #endif
 }
 
-int64_t _alpm_archive_compressed_ftell(struct archive *archive) {
+static inline int64_t _alpm_archive_compressed_ftell(struct archive *archive) {
 #if ARCHIVE_VERSION_NUMBER >= 3000000
 	return archive_filter_bytes(archive, -1);
 #else
@@ -37,7 +38,7 @@ int64_t _alpm_archive_compressed_ftell(struct archive *archive) {
 #endif
 }
 
-int _alpm_archive_read_open_file(struct archive *archive,
+static inline int _alpm_archive_read_open_file(struct archive *archive,
 		const char *filename, size_t block_size) {
 #if ARCHIVE_VERSION_NUMBER >= 3000000
 	return archive_read_open_filename(archive, filename, block_size);
@@ -46,7 +47,7 @@ int _alpm_archive_read_open_file(struct archive *archive,
 #endif
 }
 
-int _alpm_archive_filter_code(struct archive *archive) {
+static inline int _alpm_archive_filter_code(struct archive *archive) {
 #if ARCHIVE_VERSION_NUMBER >= 3000000
 	return archive_filter_code(archive, 0);
 #else
@@ -54,7 +55,7 @@ int _alpm_archive_filter_code(struct archive *archive) {
 #endif
 }
 
-int _alpm_archive_read_support_filter_all(struct archive *archive) {
+static inline int _alpm_archive_read_support_filter_all(struct archive *archive) {
 #if ARCHIVE_VERSION_NUMBER >= 3000000
 	return archive_read_support_filter_all(archive);
 #else
@@ -63,3 +64,5 @@ int _alpm_archive_read_support_filter_all(struct archive *archive) {
 }
 
 /* vim: set ts=2 sw=2 noet: */
+
+#endif /* _LIBARCHIVE_COMPAT_H */
-- 
1.8.1.1



More information about the pacman-dev mailing list