Make the other modules use error.c
This commit is contained in:
parent
6bc3ffde5d
commit
a2f2e58353
7 changed files with 26 additions and 32 deletions
7
http.c
7
http.c
|
|
@ -25,6 +25,7 @@
|
|||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include "error.h"
|
||||
#include "http.h"
|
||||
|
||||
static char* strnstrr(const char *str, const char *needle, size_t size) {
|
||||
|
|
@ -109,7 +110,7 @@ static size_t write_cb(void *src, size_t smemb, size_t nmemb, void *data) {
|
|||
|
||||
dest->block = realloc(dest->block, dest->len + size);
|
||||
if (dest->block == NULL) {
|
||||
printf("out of memory\n");
|
||||
error("out of memory\n");
|
||||
return 0;
|
||||
}
|
||||
memcpy(dest->block + dest->len, src, size);
|
||||
|
|
@ -148,7 +149,7 @@ struct http_data* http_fetch_page(const char *url) {
|
|||
res = curl_easy_perform(handle);
|
||||
|
||||
if (res != CURLE_OK) {
|
||||
printf("curl: (%s) %s\n", url, curl_easy_strerror(res));
|
||||
error("curl: (%s) %s\n", url, curl_easy_strerror(res));
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
|
@ -184,7 +185,7 @@ int http_download_file(const char *url, const char *dir) {
|
|||
res = curl_easy_perform(handle);
|
||||
|
||||
if (res != CURLE_OK) {
|
||||
printf("curl: (%s) %s\n", url, curl_easy_strerror(res));
|
||||
error("curl: (%s) %s\n", url, curl_easy_strerror(res));
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
|
|
|||
Reference in a new issue