diff options
| author | Nikola Pajkovsky <npajkovs@redhat.com> | 2010-08-26 17:20:18 +0200 |
|---|---|---|
| committer | Nikola Pajkovsky <npajkovs@redhat.com> | 2010-08-26 17:20:18 +0200 |
| commit | f76b61fdd8e4423e4e5604c91578e46bf65c3242 (patch) | |
| tree | a3a70941ff939ab5eb99e8d882db77434385d72e /lib/utils | |
| parent | d0df21e616677169c6ecd4ffecabb494498e8d5d (diff) | |
| parent | 34f9c6df27c0c44bd680a88ae6b8477b6f27f484 (diff) | |
Merge branch 'master' of ssh://git.fedorahosted.org/git/abrt
Diffstat (limited to 'lib/utils')
| -rw-r--r-- | lib/utils/Makefile.am | 6 | ||||
| -rw-r--r-- | lib/utils/abrt_curl.c (renamed from lib/utils/abrt_curl.cpp) | 2 | ||||
| -rw-r--r-- | lib/utils/abrt_curl.h | 8 | ||||
| -rw-r--r-- | lib/utils/abrt_rh_support.c (renamed from lib/utils/abrt_rh_support.cpp) | 12 | ||||
| -rw-r--r-- | lib/utils/abrt_rh_support.h | 8 | ||||
| -rw-r--r-- | lib/utils/spawn.c (renamed from lib/utils/spawn.cpp) | 32 | ||||
| -rw-r--r-- | lib/utils/time.c (renamed from lib/utils/time.cpp) | 0 | ||||
| -rw-r--r-- | lib/utils/xconnect.c (renamed from lib/utils/xconnect.cpp) | 0 |
8 files changed, 45 insertions, 23 deletions
diff --git a/lib/utils/Makefile.am b/lib/utils/Makefile.am index 92250811..66a48b06 100644 --- a/lib/utils/Makefile.am +++ b/lib/utils/Makefile.am @@ -20,7 +20,7 @@ libABRTUtils_la_SOURCES = \ daemon.c \ skip_whitespace.c \ xatonum.c numtoa.cpp \ - spawn.cpp \ + spawn.c \ stringops.cpp \ dirsize.cpp \ DebugDump.cpp \ @@ -56,8 +56,8 @@ libABRTdUtils_la_SOURCES = \ make_descr.cpp \ $(HEADER_DIR)/comm_layer_inner.h CommLayerInner.cpp \ $(HEADER_DIR)/abrt_xmlrpc.h abrt_xmlrpc.cpp \ - abrt_rh_support.h abrt_rh_support.cpp \ - abrt_curl.h abrt_curl.cpp \ + abrt_rh_support.h abrt_rh_support.c \ + abrt_curl.h abrt_curl.c \ $(HEADER_DIR)/plugin.h Plugin.cpp \ Polkit.h Polkit.cpp diff --git a/lib/utils/abrt_curl.cpp b/lib/utils/abrt_curl.c index a836f704..02506218 100644 --- a/lib/utils/abrt_curl.cpp +++ b/lib/utils/abrt_curl.c @@ -20,8 +20,6 @@ #include "abrt_curl.h" #include "comm_layer_inner.h" -using namespace std; - /* * Utility functions */ diff --git a/lib/utils/abrt_curl.h b/lib/utils/abrt_curl.h index 1f34e7ec..77b4605c 100644 --- a/lib/utils/abrt_curl.h +++ b/lib/utils/abrt_curl.h @@ -21,6 +21,10 @@ #include <curl/curl.h> +#ifdef __cplusplus +extern "C" { +#endif + CURL* xcurl_easy_init(); typedef struct abrt_post_state { @@ -85,4 +89,8 @@ abrt_post_file_as_form(abrt_post_state_t *state, return abrt_post(state, url, content_type, filename, ABRT_POST_DATA_FROMFILE_AS_FORM_DATA); } +#ifdef __cplusplus +} +#endif + #endif diff --git a/lib/utils/abrt_rh_support.cpp b/lib/utils/abrt_rh_support.c index fd78a427..04e2c8ef 100644 --- a/lib/utils/abrt_rh_support.cpp +++ b/lib/utils/abrt_rh_support.c @@ -16,19 +16,13 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -//#define _GNU_SOURCE - #include <libxml/encoding.h> #include <libxml/xmlwriter.h> #include <curl/curl.h> #include "abrtlib.h" #include "abrt_curl.h" -#include "abrt_xmlrpc.h" -#include "abrt_exception.h" #include "abrt_rh_support.h" -using namespace std; - struct reportfile { xmlTextWriterPtr writer; xmlBufferPtr buf; @@ -225,7 +219,7 @@ post_signature(const char* baseURL, bool ssl_verify, const char* signature) { char *URL = concat_path_file(baseURL, "/signatures"); - abrt_post_state *state = new_abrt_post_state(0 + abrt_post_state_t *state = new_abrt_post_state(0 + ABRT_POST_WANT_HEADERS + ABRT_POST_WANT_BODY + ABRT_POST_WANT_ERROR_MSG @@ -381,7 +375,7 @@ send_report_to_new_case(const char* baseURL, char *errmsg; char *allocated = NULL; char* retval = NULL; - abrt_post_state *case_state; + abrt_post_state_t *case_state; redirect_case: case_state = new_abrt_post_state(0 @@ -446,7 +440,7 @@ send_report_to_new_case(const char* baseURL, } char *atch_url = concat_path_file(case_location, "/attachments"); - abrt_post_state *atch_state; + abrt_post_state_t *atch_state; redirect_attach: atch_state = new_abrt_post_state(0 + ABRT_POST_WANT_HEADERS diff --git a/lib/utils/abrt_rh_support.h b/lib/utils/abrt_rh_support.h index 393a1a2c..db6e9cd7 100644 --- a/lib/utils/abrt_rh_support.h +++ b/lib/utils/abrt_rh_support.h @@ -19,6 +19,10 @@ #ifndef ABRT_RH_SUPPORT_H_ #define ABRT_RH_SUPPORT_H_ 1 +#ifdef __cplusplus +extern "C" { +#endif + typedef struct reportfile reportfile_t; reportfile_t *new_reportfile(void); @@ -44,4 +48,8 @@ send_report_to_new_case(const char* baseURL, const char* component, const char* report_file_name); +#ifdef __cplusplus +} +#endif + #endif diff --git a/lib/utils/spawn.cpp b/lib/utils/spawn.c index dace7d4b..068f4ac7 100644 --- a/lib/utils/spawn.cpp +++ b/lib/utils/spawn.c @@ -5,16 +5,26 @@ */ #include "abrtlib.h" -using namespace std; - -static string concat_str_vector(char **strings) +static char *concat_str_vector(char **strings) { - string result; - while (*strings) { - result += *strings++; - if (*strings) - result += ' '; + if (!strings[0]) + return xzalloc(1); // returns "" + + unsigned len = 0; + char **spp = strings; + while (*spp) + len += strlen(*spp++) + 1; + + char *result = xmalloc(len); + + char *r = result; + spp = strings; + while (*spp) { + r = stpcpy(r, *spp++); + *r++ = ' '; } + *--r = '\0'; + return result; } @@ -79,7 +89,11 @@ pid_t fork_execv_on_steroids(int flags, } /* This should be done BEFORE stderr redirect */ - VERB1 log("Executing: %s", concat_str_vector(argv).c_str()); + VERB1 { + char *r = concat_str_vector(argv); + log("Executing: %s", r); + free(r); + } if (flags & EXECFLG_ERR2OUT) { /* Want parent to see errors in the same stream */ diff --git a/lib/utils/time.cpp b/lib/utils/time.c index 37ade2cc..37ade2cc 100644 --- a/lib/utils/time.cpp +++ b/lib/utils/time.c diff --git a/lib/utils/xconnect.cpp b/lib/utils/xconnect.c index 0d02b1a4..0d02b1a4 100644 --- a/lib/utils/xconnect.cpp +++ b/lib/utils/xconnect.c |
