summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenys Vlasenko <dvlasenk@redhat.com>2010-08-24 12:09:21 +0200
committerDenys Vlasenko <dvlasenk@redhat.com>2010-08-24 12:09:21 +0200
commitd19af002e83237b5f8b67eae171a008c9bd3ccc5 (patch)
treeff3476622994cfa8e32e7a45cf9a8d3436d6678d
parent14abf4481f0fb60c0141d9ab32d8a73d4f974875 (diff)
downloadabrt-d19af002e83237b5f8b67eae171a008c9bd3ccc5.tar.gz
abrt-d19af002e83237b5f8b67eae171a008c9bd3ccc5.tar.xz
abrt-d19af002e83237b5f8b67eae171a008c9bd3ccc5.zip
make abrtlib.h include'able from .c files, not only .cpp
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
-rw-r--r--inc/abrt_types.h4
-rw-r--r--inc/abrtlib.h10
-rw-r--r--lib/utils/copyfd.cpp4
3 files changed, 13 insertions, 5 deletions
diff --git a/inc/abrt_types.h b/inc/abrt_types.h
index ae22b03d..38804895 100644
--- a/inc/abrt_types.h
+++ b/inc/abrt_types.h
@@ -19,6 +19,8 @@
#ifndef ABRT_TYPES_H_
#define ABRT_TYPES_H_
+#ifdef __cplusplus
+
#include <map>
#include <set>
#include <vector>
@@ -43,4 +45,6 @@ typedef map_vector_string_t report_status_t;
/* Holds result of .conf file section parsing: map["name"] = "value" */
typedef map_string_t map_plugin_settings_t;
+#endif /* __cplusplus */
+
#endif
diff --git a/inc/abrtlib.h b/inc/abrtlib.h
index 713694b8..f38374e3 100644
--- a/inc/abrtlib.h
+++ b/inc/abrtlib.h
@@ -38,7 +38,9 @@
#include <pwd.h>
#include <grp.h>
/* C++ bits */
-#include <string>
+#ifdef __cplusplus
+# include <string>
+#endif
/* Some libc's forget to declare these, do it ourself */
extern char **environ;
@@ -93,8 +95,8 @@ int xatoi_u(const char *numstr);
enum {
COPYFD_SPARSE = 1 << 0,
};
-off_t copyfd_eof(int src_fd, int dst_fd, int flags = 0);
-off_t copyfd_size(int src_fd, int dst_fd, off_t size, int flags = 0);
+off_t copyfd_eof(int src_fd, int dst_fd, int flags);
+off_t copyfd_size(int src_fd, int dst_fd, off_t size, int flags);
void copyfd_exact_size(int src_fd, int dst_fd, off_t size);
off_t copy_file(const char *src_name, const char *dst_name, int mode);
@@ -183,6 +185,7 @@ int daemon_is_ok();
char *encode_base64(const void *src, int length);
/* C++ style stuff */
+#ifdef __cplusplus
double get_dirsize(const char *pPath);
double get_dirsize_find_largest_dir(
const char *pPath,
@@ -201,6 +204,7 @@ std::string to_string(T x)
void parse_args(const char *psArgs, vector_string_t& pArgs, int quote = -1);
void parse_release(const char *pRelease, char **product, char **version);
+#endif
// TODO: npajkovs: full rewrite ssprintf -> xasprintf
static inline std::string ssprintf(const char *format, ...)
diff --git a/lib/utils/copyfd.cpp b/lib/utils/copyfd.cpp
index cbcf7005..61acc479 100644
--- a/lib/utils/copyfd.cpp
+++ b/lib/utils/copyfd.cpp
@@ -134,7 +134,7 @@ off_t copyfd_size(int fd1, int fd2, off_t size, int flags)
void copyfd_exact_size(int fd1, int fd2, off_t size)
{
- off_t sz = copyfd_size(fd1, fd2, size);
+ off_t sz = copyfd_size(fd1, fd2, size, /*flags:*/ 0);
if (sz == size)
return;
if (sz != -1)
@@ -164,7 +164,7 @@ off_t copy_file(const char *src_name, const char *dst_name, int mode)
perror_msg("Can't open '%s'", dst_name);
return -1;
}
- r = copyfd_eof(src, dst);
+ r = copyfd_eof(src, dst, /*flags:*/ 0);
close(src);
close(dst);
return r;