summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Schoenert <c.schoenert@gmail.com>2013-11-29 14:19:14 (EST)
committer Paul Barker <paul@paulbarker.me.uk>2013-12-17 16:00:36 (EST)
commitfed9b245150a7faa630f7615302c472b7c68ff3e (patch)
tree1dfc15f3fc9f10b5db423ff9644ac25882d2f8db
parent8614cc4cac82328d76ae725c823d7d289137a3a1 (diff)
libopkg: ensure symbol name mangling for C++
Users who use C++ code for theirs application have always to include external C functions with a 'extern "C" { }' assignment. We can take that need from the user by putting thees assignments into the public header files. Signed-off-by: Carsten Schoenert <c.schoenert@gmail.com> Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
-rw-r--r--libopkg/cksum_list.h8
-rw-r--r--libopkg/conffile.h7
-rw-r--r--libopkg/conffile_list.h7
-rw-r--r--libopkg/file_util.h8
-rw-r--r--libopkg/hash_table.h8
-rw-r--r--libopkg/list.h8
-rw-r--r--libopkg/md5.h8
-rw-r--r--libopkg/nv_pair.h7
-rw-r--r--libopkg/nv_pair_list.h7
-rw-r--r--libopkg/opkg.h8
-rw-r--r--libopkg/opkg_cmd.h9
-rw-r--r--libopkg/opkg_conf.h8
-rw-r--r--libopkg/opkg_configure.h8
-rw-r--r--libopkg/opkg_download.h8
-rw-r--r--libopkg/opkg_install.h8
-rw-r--r--libopkg/opkg_message.h8
-rw-r--r--libopkg/opkg_remove.h7
-rw-r--r--libopkg/opkg_upgrade.h8
-rw-r--r--libopkg/opkg_utils.h8
-rw-r--r--libopkg/parse_util.h8
-rw-r--r--libopkg/pkg.h8
-rw-r--r--libopkg/pkg_depends.h8
-rw-r--r--libopkg/pkg_dest.h8
-rw-r--r--libopkg/pkg_dest_list.h8
-rw-r--r--libopkg/pkg_extract.h8
-rw-r--r--libopkg/pkg_hash.h8
-rw-r--r--libopkg/pkg_parse.h8
-rw-r--r--libopkg/pkg_src.h8
-rw-r--r--libopkg/pkg_src_list.h8
-rw-r--r--libopkg/pkg_vec.h9
-rw-r--r--libopkg/release.h8
-rw-r--r--libopkg/release_parse.h8
-rw-r--r--libopkg/sha256.h8
-rw-r--r--libopkg/sprintf_alloc.h8
-rw-r--r--libopkg/str_list.h8
-rw-r--r--libopkg/void_list.h7
-rw-r--r--libopkg/xregex.h7
-rw-r--r--libopkg/xsystem.h8
38 files changed, 299 insertions, 0 deletions
diff --git a/libopkg/cksum_list.h b/libopkg/cksum_list.h
index b752288..cfa8ec0 100644
--- a/libopkg/cksum_list.h
+++ b/libopkg/cksum_list.h
@@ -16,6 +16,10 @@
#ifndef CKSUM_LIST_H
#define CKSUM_LIST_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef struct
{
char *name;
@@ -43,4 +47,8 @@ void cksum_list_deinit(cksum_list_t *list);
cksum_t *cksum_list_append(cksum_list_t *list, char **itemlist);
const cksum_t *cksum_list_find(cksum_list_t *list, const char *name);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/libopkg/conffile.h b/libopkg/conffile.h
index a188c6d..9747be6 100644
--- a/libopkg/conffile.h
+++ b/libopkg/conffile.h
@@ -18,6 +18,10 @@
#ifndef CONFFILE_H
#define CONFFILE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include "nv_pair.h"
typedef struct nv_pair conffile_t;
@@ -25,5 +29,8 @@ int conffile_init(conffile_t *conffile, const char *file_name, const char *md5su
void conffile_deinit(conffile_t *conffile);
int conffile_has_been_modified(conffile_t *conffile);
+#ifdef __cplusplus
+}
#endif
+#endif
diff --git a/libopkg/conffile_list.h b/libopkg/conffile_list.h
index 942f68e..5d4293a 100644
--- a/libopkg/conffile_list.h
+++ b/libopkg/conffile_list.h
@@ -18,6 +18,10 @@
#ifndef CONFFILE_LIST_H
#define CONFFILE_LIST_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include "nv_pair_list.h"
typedef nv_pair_list_elt_t conffile_list_elt_t;
@@ -33,5 +37,8 @@ conffile_t *conffile_list_append(conffile_list_t *list, const char *name,
void conffile_list_push(conffile_list_t *list, conffile_t *data);
conffile_list_elt_t *conffile_list_pop(conffile_list_t *list);
+#ifdef __cplusplus
+}
#endif
+#endif
diff --git a/libopkg/file_util.h b/libopkg/file_util.h
index cfad551..95f7fe7 100644
--- a/libopkg/file_util.h
+++ b/libopkg/file_util.h
@@ -18,6 +18,10 @@
#ifndef FILE_UTIL_H
#define FILE_UTIL_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
int file_exists(const char *file_name);
int file_is_dir(const char *file_name);
char *file_read_line_alloc(FILE *file);
@@ -28,4 +32,8 @@ char *file_md5sum_alloc(const char *file_name);
char *file_sha256sum_alloc(const char *file_name);
int rm_r(const char *path);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/libopkg/hash_table.h b/libopkg/hash_table.h
index 472b3e2..6113523 100644
--- a/libopkg/hash_table.h
+++ b/libopkg/hash_table.h
@@ -18,6 +18,10 @@
#ifndef _HASH_TABLE_H_
#define _HASH_TABLE_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef struct hash_entry hash_entry_t;
typedef struct hash_table hash_table_t;
@@ -48,4 +52,8 @@ int hash_table_insert(hash_table_t *hash, const char *key, void *value);
int hash_table_remove(hash_table_t *has, const char *key);
void hash_table_foreach(hash_table_t *hash, void (*f)(const char *key, void *entry, void *data), void *data);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* _HASH_TABLE_H_ */
diff --git a/libopkg/list.h b/libopkg/list.h
index c1325db..250eebb 100644
--- a/libopkg/list.h
+++ b/libopkg/list.h
@@ -20,6 +20,10 @@
#ifndef _LINUX_LIST_H
#define _LINUX_LIST_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct list_head {
struct list_head *next, *prev;
};
@@ -301,4 +305,8 @@ static inline void list_splice_init(struct list_head *list,
&pos->member != (head); \
pos = n, n = list_entry(n->member.next, typeof(*n), member))
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/libopkg/md5.h b/libopkg/md5.h
index 3ae657b..e89c62e 100644
--- a/libopkg/md5.h
+++ b/libopkg/md5.h
@@ -24,6 +24,10 @@
#include <stdio.h>
#include <stdint.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define MD5_DIGEST_SIZE 16
#define MD5_BLOCK_SIZE 64
@@ -115,4 +119,8 @@ extern int __md5_stream (FILE *stream, void *resblock) __THROW;
extern void *__md5_buffer (const char *buffer, size_t len,
void *resblock) __THROW;
+#ifdef __cplusplus
+}
+#endif
+
#endif /* md5.h */
diff --git a/libopkg/nv_pair.h b/libopkg/nv_pair.h
index 72513e4..98c1706 100644
--- a/libopkg/nv_pair.h
+++ b/libopkg/nv_pair.h
@@ -18,6 +18,10 @@
#ifndef NV_PAIR_H
#define NV_PAIR_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef struct nv_pair nv_pair_t;
struct nv_pair
{
@@ -28,5 +32,8 @@ struct nv_pair
int nv_pair_init(nv_pair_t *nv_pair, const char *name, const char *value);
void nv_pair_deinit(nv_pair_t *nv_pair);
+#ifdef __cplusplus
+}
#endif
+#endif
diff --git a/libopkg/nv_pair_list.h b/libopkg/nv_pair_list.h
index 1223a1f..cf8893c 100644
--- a/libopkg/nv_pair_list.h
+++ b/libopkg/nv_pair_list.h
@@ -18,6 +18,10 @@
#ifndef NV_PAIR_LIST_H
#define NV_PAIR_LIST_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include "nv_pair.h"
#include "void_list.h"
@@ -44,5 +48,8 @@ nv_pair_list_elt_t *nv_pair_list_prev(nv_pair_list_t *list, nv_pair_list_elt_t *
nv_pair_list_elt_t *nv_pair_list_next(nv_pair_list_t *list, nv_pair_list_elt_t *node);
nv_pair_list_elt_t *nv_pair_list_last(nv_pair_list_t *list);
+#ifdef __cplusplus
+}
#endif
+#endif
diff --git a/libopkg/opkg.h b/libopkg/opkg.h
index 7aa86eb..4c8f902 100644
--- a/libopkg/opkg.h
+++ b/libopkg/opkg.h
@@ -18,6 +18,10 @@
#ifndef OPKG_H
#define OPKG_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include "pkg.h"
#include "opkg_message.h"
@@ -60,4 +64,8 @@ int opkg_repository_accessibility_check(void);
int opkg_compare_versions (const char *ver1, const char *ver2);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* OPKG_H */
diff --git a/libopkg/opkg_cmd.h b/libopkg/opkg_cmd.h
index 9ca42ff..8fa70fc 100644
--- a/libopkg/opkg_cmd.h
+++ b/libopkg/opkg_cmd.h
@@ -18,6 +18,10 @@
#ifndef OPKG_CMD_H
#define OPKG_CMD_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef int (*opkg_cmd_fun_t)(int argc, const char **argv);
struct opkg_cmd
@@ -33,4 +37,9 @@ opkg_cmd_t *opkg_cmd_find(const char *name);
int opkg_cmd_exec(opkg_cmd_t *cmd, int argc, const char **argv);
extern int opkg_state_changed;
+
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/libopkg/opkg_conf.h b/libopkg/opkg_conf.h
index 70bfadf..1fc8515 100644
--- a/libopkg/opkg_conf.h
+++ b/libopkg/opkg_conf.h
@@ -23,6 +23,10 @@ extern opkg_conf_t *conf;
#include <stdarg.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include "hash_table.h"
#include "pkg_src_list.h"
#include "pkg_dest_list.h"
@@ -144,4 +148,8 @@ void opkg_conf_deinit(void);
int opkg_conf_write_status_files(void);
char *root_filename_alloc(char *filename);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/libopkg/opkg_configure.h b/libopkg/opkg_configure.h
index ff01ff3..1889a04 100644
--- a/libopkg/opkg_configure.h
+++ b/libopkg/opkg_configure.h
@@ -18,8 +18,16 @@
#ifndef OPKG_CONFIGURE_H
#define OPKG_CONFIGURE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include "pkg.h"
int opkg_configure(pkg_t *pkg);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/libopkg/opkg_download.h b/libopkg/opkg_download.h
index af77859..ff5f7da 100644
--- a/libopkg/opkg_download.h
+++ b/libopkg/opkg_download.h
@@ -18,6 +18,10 @@
#ifndef OPKG_DOWNLOAD_H
#define OPKG_DOWNLOAD_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include "pkg.h"
typedef void (*opkg_download_progress_callback)(int percent, char *url);
@@ -40,4 +44,8 @@ int opkg_verify_file (char *text_file, char *sig_file);
* order to present a consistent API.
*/
void opkg_curl_cleanup(void);
+
+#ifdef __cplusplus
+}
+#endif
#endif
diff --git a/libopkg/opkg_install.h b/libopkg/opkg_install.h
index eaffff8..48acc55 100644
--- a/libopkg/opkg_install.h
+++ b/libopkg/opkg_install.h
@@ -18,10 +18,18 @@
#ifndef OPKG_INSTALL_H
#define OPKG_INSTALL_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include "pkg.h"
#include "opkg_conf.h"
int opkg_install_by_name(const char *pkg_name);
int opkg_install_pkg(pkg_t *pkg, int from_upgrading);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/libopkg/opkg_message.h b/libopkg/opkg_message.h
index 4fa2a0b..adc4e4a 100644
--- a/libopkg/opkg_message.h
+++ b/libopkg/opkg_message.h
@@ -20,6 +20,10 @@
#include <string.h>
#include <errno.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef enum {
ERROR, /* error conditions */
NOTICE, /* normal but significant condition */
@@ -44,4 +48,8 @@ void opkg_message(message_level_t level, const char *fmt, ...)
#define opkg_perror(l, fmt, args...) \
opkg_msg(l, fmt": %s.\n", ##args, strerror(errno))
+#ifdef __cplusplus
+}
+#endif
+
#endif /* _OPKG_MESSAGE_H_ */
diff --git a/libopkg/opkg_remove.h b/libopkg/opkg_remove.h
index f0c45d2..2cb605f 100644
--- a/libopkg/opkg_remove.h
+++ b/libopkg/opkg_remove.h
@@ -18,6 +18,10 @@
#ifndef OPKG_REMOVE_H
#define OPKG_REMOVE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include "pkg.h"
#include "opkg_conf.h"
@@ -26,5 +30,8 @@ int pkg_has_installed_dependents(pkg_t *pkg, abstract_pkg_t *** pdependents);
void remove_data_files_and_list(pkg_t *pkg);
void remove_maintainer_scripts(pkg_t *pkg);
+#ifdef __cplusplus
+}
+#endif
#endif
diff --git a/libopkg/opkg_upgrade.h b/libopkg/opkg_upgrade.h
index 6545fa8..5bed335 100644
--- a/libopkg/opkg_upgrade.h
+++ b/libopkg/opkg_upgrade.h
@@ -15,8 +15,16 @@
#ifndef OPKG_UPGRADE_H
#define OPKG_UPGRADE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include "active_list.h"
int opkg_upgrade_pkg(pkg_t *old);
struct active_list * prepare_upgrade_list (void);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/libopkg/opkg_utils.h b/libopkg/opkg_utils.h
index 092d158..33074b9 100644
--- a/libopkg/opkg_utils.h
+++ b/libopkg/opkg_utils.h
@@ -18,8 +18,16 @@
#ifndef OPKG_UTILS_H
#define OPKG_UTILS_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
unsigned long get_available_kbytes(char * filesystem);
char *trim_xstrdup(const char *line);
int line_is_blank(const char *line);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/libopkg/parse_util.h b/libopkg/parse_util.h
index 26e2d5b..0a4fbda 100644
--- a/libopkg/parse_util.h
+++ b/libopkg/parse_util.h
@@ -18,6 +18,10 @@
#ifndef PARSE_UTIL_H
#define PARSE_UTIL_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
int is_field(const char *type, const char *line);
char *parse_simple(const char *type, const char *line);
char **parse_list(const char *raw, unsigned int *count, const char sep, int skip_field);
@@ -28,4 +32,8 @@ int parse_from_stream_nomalloc(parse_line_t parse_line, void *item, FILE *fp, ui
#define EXCESSIVE_LINE_LEN (4096 << 8)
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/libopkg/pkg.h b/libopkg/pkg.h
index ad37ae9..744dd9f 100644
--- a/libopkg/pkg.h
+++ b/libopkg/pkg.h
@@ -20,6 +20,10 @@
#include <sys/types.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include "pkg_vec.h"
#include "str_list.h"
#include "active_list.h"
@@ -225,4 +229,8 @@ void pkg_info_preinstall_check(void);
int pkg_write_filelist(pkg_t *pkg);
int pkg_write_changed_filelists(void);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/libopkg/pkg_depends.h b/libopkg/pkg_depends.h
index 685a722..25461da 100644
--- a/libopkg/pkg_depends.h
+++ b/libopkg/pkg_depends.h
@@ -18,6 +18,10 @@
#ifndef PKG_DEPENDS_H
#define PKG_DEPENDS_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include "pkg.h"
#include "pkg_hash.h"
@@ -90,4 +94,8 @@ const char* constraint_to_str(enum version_constraint c);
enum version_constraint str_to_constraint(char **str);
int is_pkg_in_pkg_vec(pkg_vec_t * vec, pkg_t * pkg);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/libopkg/pkg_dest.h b/libopkg/pkg_dest.h
index 4ad417e..5beb601 100644
--- a/libopkg/pkg_dest.h
+++ b/libopkg/pkg_dest.h
@@ -20,6 +20,10 @@
#include <stdio.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef struct pkg_dest pkg_dest_t;
struct pkg_dest
{
@@ -35,5 +39,9 @@ struct pkg_dest
int pkg_dest_init(pkg_dest_t *dest, const char *name, const char *root_dir,const char *lists_dir);
void pkg_dest_deinit(pkg_dest_t *dest);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/libopkg/pkg_dest_list.h b/libopkg/pkg_dest_list.h
index 33aef19..421a827 100644
--- a/libopkg/pkg_dest_list.h
+++ b/libopkg/pkg_dest_list.h
@@ -18,6 +18,10 @@
#ifndef PKG_DEST_LIST_H
#define PKG_DEST_LIST_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include "pkg_dest.h"
typedef struct void_list_elt pkg_dest_list_elt_t;
@@ -35,5 +39,9 @@ pkg_dest_t *pkg_dest_list_append(pkg_dest_list_t *list, const char *name,
void pkg_dest_list_push(pkg_dest_list_t *list, pkg_dest_t *data);
pkg_dest_list_elt_t *pkg_dest_list_pop(pkg_dest_list_t *list);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/libopkg/pkg_extract.h b/libopkg/pkg_extract.h
index b83b41b..82ef8b1 100644
--- a/libopkg/pkg_extract.h
+++ b/libopkg/pkg_extract.h
@@ -18,6 +18,10 @@
#ifndef PKG_EXTRACT_H
#define PKG_EXTRACT_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include "pkg.h"
int pkg_extract_control_file_to_stream(pkg_t *pkg, FILE *stream);
@@ -28,4 +32,8 @@ int pkg_extract_control_files_to_dir_with_prefix(pkg_t *pkg,
int pkg_extract_data_files_to_dir(pkg_t *pkg, const char *dir);
int pkg_extract_data_file_names_to_stream(pkg_t *pkg, FILE *file);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/libopkg/pkg_hash.h b/libopkg/pkg_hash.h
index b3cf3d1..8901a9b 100644
--- a/libopkg/pkg_hash.h
+++ b/libopkg/pkg_hash.h
@@ -18,6 +18,10 @@
#ifndef PKG_HASH_H
#define PKG_HASH_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include "pkg.h"
#include "pkg_src.h"
#include "pkg_dest.h"
@@ -52,5 +56,9 @@ void file_hash_remove(const char *file_name);
pkg_t *file_hash_get_file_owner(const char *file_name);
void file_hash_set_file_owner(const char *file_name, pkg_t *pkg);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/libopkg/pkg_parse.h b/libopkg/pkg_parse.h
index 4e2b8e0..358afa9 100644
--- a/libopkg/pkg_parse.h
+++ b/libopkg/pkg_parse.h
@@ -18,6 +18,10 @@
#ifndef PKG_PARSE_H
#define PKG_PARSE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include "pkg.h"
int parse_version(pkg_t *pkg, const char *raw);
@@ -54,4 +58,8 @@ int pkg_parse_line(void *ptr, const char *line, uint mask);
#define PFM_ALL (~(uint)0)
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/libopkg/pkg_src.h b/libopkg/pkg_src.h
index b1a95a5..30192bb 100644
--- a/libopkg/pkg_src.h
+++ b/libopkg/pkg_src.h
@@ -18,6 +18,10 @@
#ifndef PKG_SRC_H
#define PKG_SRC_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include "nv_pair.h"
typedef struct
@@ -31,4 +35,8 @@ typedef struct
int pkg_src_init(pkg_src_t *src, const char *name, const char *base_url, const char *extra_data, int gzip);
void pkg_src_deinit(pkg_src_t *src);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/libopkg/pkg_src_list.h b/libopkg/pkg_src_list.h
index 529f013..14d6445 100644
--- a/libopkg/pkg_src_list.h
+++ b/libopkg/pkg_src_list.h
@@ -18,6 +18,10 @@
#ifndef PKG_SRC_LIST_H
#define PKG_SRC_LIST_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include "pkg_src.h"
#include "void_list.h"
@@ -40,5 +44,9 @@ pkg_src_t *pkg_src_list_append(pkg_src_list_t *list, const char *name, const cha
void pkg_src_list_push(pkg_src_list_t *list, pkg_src_t *data);
pkg_src_list_elt_t *pkg_src_list_pop(pkg_src_list_t *list);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/libopkg/pkg_vec.h b/libopkg/pkg_vec.h
index 8ee1673..74e3c97 100644
--- a/libopkg/pkg_vec.h
+++ b/libopkg/pkg_vec.h
@@ -18,6 +18,10 @@
#ifndef PKG_VEC_H
#define PKG_VEC_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef struct pkg pkg_t;
typedef struct abstract_pkg abstract_pkg_t;
typedef struct pkg_vec pkg_vec_t;
@@ -59,5 +63,10 @@ int abstract_pkg_vec_contains(abstract_pkg_vec_t *vec, abstract_pkg_t *apkg);
void abstract_pkg_vec_sort(pkg_vec_t *vec, compare_fcn_t compar);
int pkg_compare_names(const void *p1, const void *p2);
+
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/libopkg/release.h b/libopkg/release.h
index 1c89c8e..99c36a5 100644
--- a/libopkg/release.h
+++ b/libopkg/release.h
@@ -16,6 +16,10 @@
#ifndef RELEASE_H
#define RELEASE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <stdio.h>
#include "pkg.h"
#include "cksum_list.h"
@@ -48,4 +52,8 @@ const char **release_comps(release_t *release, unsigned int *count);
int release_verify_file(release_t *release, const char *filename, const char *pathname);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/libopkg/release_parse.h b/libopkg/release_parse.h
index 5840df6..424b3b5 100644
--- a/libopkg/release_parse.h
+++ b/libopkg/release_parse.h
@@ -16,6 +16,14 @@
#ifndef RELEASE_PARSE_H
#define RELEASE_PARSE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
int release_parse_from_stream(release_t *release, FILE *fp);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/libopkg/sha256.h b/libopkg/sha256.h
index ccbe6cf..c53277d 100644
--- a/libopkg/sha256.h
+++ b/libopkg/sha256.h
@@ -22,6 +22,10 @@
# include <stdio.h>
# include <stdint.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Structure to save state of computation between the single steps. */
struct sha256_ctx
{
@@ -85,4 +89,8 @@ extern int sha224_stream (FILE *stream, void *resblock);
extern void *sha256_buffer (const char *buffer, size_t len, void *resblock);
extern void *sha224_buffer (const char *buffer, size_t len, void *resblock);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/libopkg/sprintf_alloc.h b/libopkg/sprintf_alloc.h
index bcf42a4..fc00403 100644
--- a/libopkg/sprintf_alloc.h
+++ b/libopkg/sprintf_alloc.h
@@ -18,6 +18,14 @@
#ifndef SPRINTF_ALLOC_H
#define SPRINTF_ALLOC_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void sprintf_alloc(char **str, const char *fmt, ...);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/libopkg/str_list.h b/libopkg/str_list.h
index 3690820..f0a714d 100644
--- a/libopkg/str_list.h
+++ b/libopkg/str_list.h
@@ -18,6 +18,10 @@
#ifndef STR_LIST_H
#define STR_LIST_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include "void_list.h"
typedef struct void_list_elt str_list_elt_t;
@@ -44,4 +48,8 @@ str_list_elt_t *str_list_last(str_list_t *list);
void str_list_purge(str_list_t *list);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/libopkg/void_list.h b/libopkg/void_list.h
index b63a68d..8cb85f2 100644
--- a/libopkg/void_list.h
+++ b/libopkg/void_list.h
@@ -18,6 +18,10 @@
#ifndef VOID_LIST_H
#define VOID_LIST_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include "list.h"
typedef struct void_list_elt void_list_elt_t;
@@ -60,5 +64,8 @@ void_list_elt_t *void_list_last(void_list_t *list);
void void_list_purge(void_list_t *list);
+#ifdef __cplusplus
+}
+#endif
#endif
diff --git a/libopkg/xregex.h b/libopkg/xregex.h
index f67572b..9fc55a1 100644
--- a/libopkg/xregex.h
+++ b/libopkg/xregex.h
@@ -21,11 +21,18 @@
#include <sys/types.h>
#include <regex.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
int xregcomp(regex_t *preg, const char *regex, int cflags);
static inline void xregfree(regex_t *preg)
{
regfree(preg);
}
+#ifdef __cplusplus
+}
+#endif
#endif
diff --git a/libopkg/xsystem.h b/libopkg/xsystem.h
index 042efad..51678e3 100644
--- a/libopkg/xsystem.h
+++ b/libopkg/xsystem.h
@@ -18,6 +18,10 @@
#ifndef XSYSTEM_H
#define XSYSTEM_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Like system(3), but with error messages printed if the fork fails
or if the child process dies due to an uncaught signal. Also, the
return value is a bit simpler:
@@ -28,5 +32,9 @@
*/
int xsystem(const char *argv[]);
+#ifdef __cplusplus
+}
+#endif
+
#endif