aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2015-05-09 22:25:30 -0300
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2015-05-09 22:25:30 -0300
commit15d3beecdd227c08df600336dff9ecd2d5979136 (patch)
tree14601d06e48a8dc20cc60a19f6d978ee4ac13dd5
parent0cb80d3050de4adb65b6c4acb4c9ac765b2ae448 (diff)
downloadblogc-15d3beecdd227c08df600336dff9ecd2d5979136.tar.gz
blogc-15d3beecdd227c08df600336dff9ecd2d5979136.tar.bz2
blogc-15d3beecdd227c08df600336dff9ecd2d5979136.zip
fixing gcc stupidity
-rw-r--r--Makefile.am2
-rw-r--r--src/file.c11
-rw-r--r--src/file.h3
-rw-r--r--src/loader.c2
-rw-r--r--tests/check_loader.c6
5 files changed, 19 insertions, 5 deletions
diff --git a/Makefile.am b/Makefile.am
index 3a29f17..9302a7e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -123,7 +123,7 @@ tests_check_loader_CFLAGS = \
tests_check_loader_LDFLAGS = \
-no-install \
-Wl,--wrap=blogc_file_get_contents \
- -Wl,--wrap=fprintf \
+ -Wl,--wrap=blogc_fprintf \
$(NULL)
tests_check_loader_LDADD = \
diff --git a/src/file.c b/src/file.c
index 7648340..5839949 100644
--- a/src/file.c
+++ b/src/file.c
@@ -48,3 +48,14 @@ blogc_file_get_contents(const char *path, size_t *len, blogc_error_t **err)
fclose(fp);
return b_string_free(str, false);
}
+
+
+int
+blogc_fprintf(FILE *stream, const char *format, ...)
+{
+ va_list ap;
+ va_start(ap, format);
+ int rv = vfprintf(stream, format, ap);
+ va_end(ap);
+ return rv;
+}
diff --git a/src/file.h b/src/file.h
index 5abdba7..5ff8dd0 100644
--- a/src/file.h
+++ b/src/file.h
@@ -9,11 +9,14 @@
#ifndef _FILE_H
#define _FILE_H
+#include <stdio.h>
+#include <stdlib.h>
#include "utils/utils.h"
#include "error.h"
#define BLOGC_FILE_CHUNK_SIZE 1024
char* blogc_file_get_contents(const char *path, size_t *len, blogc_error_t **err);
+int blogc_fprintf(FILE *stream, const char *format, ...);
#endif /* _FILE_H */
diff --git a/src/loader.c b/src/loader.c
index f868aeb..bcab0d6 100644
--- a/src/loader.c
+++ b/src/loader.c
@@ -138,7 +138,7 @@ blogc_source_parse_from_files(b_trie_t *conf, b_slist_t *l, blogc_error_t **err)
}
if (with_date > 0 && with_date < b_slist_length(l))
// fatal error, maybe?
- fprintf(stderr,
+ blogc_fprintf(stderr,
"blogc: warning: 'DATE' variable provided for at least one source "
"file, but not for all source files. This means that you may get "
"wrong values for 'DATE_FIRST' and 'DATE_LAST' variables.\n");
diff --git a/tests/check_loader.c b/tests/check_loader.c
index d478871..64d8ec8 100644
--- a/tests/check_loader.c
+++ b/tests/check_loader.c
@@ -67,7 +67,7 @@ __wrap_blogc_file_get_contents(const char *path, size_t *len, blogc_error_t **er
int
-__wrap_fprintf(FILE *stream, const char *format, ...)
+__wrap_blogc_fprintf(FILE *stream, const char *format, ...)
{
assert_true(stream == mock_type(FILE*));
assert_string_equal(format, mock_type(const char*));
@@ -179,8 +179,8 @@ test_source_parse_from_files(void **state)
static void
test_source_parse_from_files_without_all_dates(void **state)
{
- will_return(__wrap_fprintf, stderr);
- will_return(__wrap_fprintf,
+ will_return(__wrap_blogc_fprintf, stderr);
+ will_return(__wrap_blogc_fprintf,
"blogc: warning: 'DATE' variable provided for at least one source "
"file, but not for all source files. This means that you may get wrong "
"values for 'DATE_FIRST' and 'DATE_LAST' variables.\n");