Loading src/tool_main.c +36 −36 Original line number Original line Diff line number Diff line Loading @@ -121,7 +121,7 @@ static void memory_tracking_init(void) * _any_ libcurl usage. If this fails, *NO* libcurl functions may be * _any_ libcurl usage. If this fails, *NO* libcurl functions may be * used, or havoc may be the result. * used, or havoc may be the result. */ */ static CURLcode main_init(struct OperationConfig *config) static CURLcode main_init(struct GlobalConfig *config) { { CURLcode result = CURLE_OK; CURLcode result = CURLE_OK; Loading @@ -130,17 +130,29 @@ static CURLcode main_init(struct OperationConfig *config) _djstat_flags |= _STAT_INODE | _STAT_EXEC_MAGIC | _STAT_DIRSIZE; _djstat_flags |= _STAT_INODE | _STAT_EXEC_MAGIC | _STAT_DIRSIZE; #endif #endif /* Allocate the initial operate config */ config->first = malloc(sizeof(struct OperationConfig)); if(config->first) { /* Perform the libcurl initialization */ /* Perform the libcurl initialization */ result = curl_global_init(CURL_GLOBAL_DEFAULT); result = curl_global_init(CURL_GLOBAL_DEFAULT); if(!result) { if(!result) { /* Get information about libcurl */ /* Get information about libcurl */ result = get_libcurl_info(); result = get_libcurl_info(); if(result) if(!result) { helpf(config->errors, "error retrieving curl library information\n"); /* Initialise the config */ config_init(config->first); } else helpf(stderr, "error retrieving curl library information\n"); } } else else helpf(config->errors, "error initializing curl library\n"); helpf(stderr, "error initializing curl library\n"); } else { helpf(stderr, "error initializing curl\n"); result = CURLE_FAILED_INIT; } return result; return result; } } Loading @@ -163,8 +175,6 @@ int main(int argc, char *argv[]) { { CURLcode result = CURLE_OK; CURLcode result = CURLE_OK; struct GlobalConfig global; struct GlobalConfig global; struct OperationConfig *config; memset(&global, 0, sizeof(global)); memset(&global, 0, sizeof(global)); main_checkfds(); main_checkfds(); Loading @@ -176,36 +186,26 @@ int main(int argc, char *argv[]) /* Initialize memory tracking */ /* Initialize memory tracking */ memory_tracking_init(); memory_tracking_init(); /* Allocate the initial operate config */ config = malloc(sizeof(struct OperationConfig)); if(config) { /* Initialise the config */ config_init(config); /* Initialize the curl library - do not call any libcurl functions before /* Initialize the curl library - do not call any libcurl functions before this point */ this point */ result = main_init(config); result = main_init(&global); if(!result) { if(!result) { /* Start our curl operation */ /* Start our curl operation */ result = operate(config, argc, argv); result = operate(global.first, argc, argv); /* Perform the main cleanup */ /* Perform the main cleanup */ main_free(); main_free(); } } if(global.first) { #ifdef __SYMBIAN32__ #ifdef __SYMBIAN32__ if(config->showerror) if(global->first->showerror) tool_pressanykey(); tool_pressanykey(); #endif #endif /* Free the config structures */ /* Free the config structures */ config_free(config); config_free(global.first); config = NULL; global.first = NULL; } else { helpf(stderr, "error initializing curl\n"); result = CURLE_FAILED_INIT; } } #ifdef __NOVELL_LIBC__ #ifdef __NOVELL_LIBC__ Loading Loading
src/tool_main.c +36 −36 Original line number Original line Diff line number Diff line Loading @@ -121,7 +121,7 @@ static void memory_tracking_init(void) * _any_ libcurl usage. If this fails, *NO* libcurl functions may be * _any_ libcurl usage. If this fails, *NO* libcurl functions may be * used, or havoc may be the result. * used, or havoc may be the result. */ */ static CURLcode main_init(struct OperationConfig *config) static CURLcode main_init(struct GlobalConfig *config) { { CURLcode result = CURLE_OK; CURLcode result = CURLE_OK; Loading @@ -130,17 +130,29 @@ static CURLcode main_init(struct OperationConfig *config) _djstat_flags |= _STAT_INODE | _STAT_EXEC_MAGIC | _STAT_DIRSIZE; _djstat_flags |= _STAT_INODE | _STAT_EXEC_MAGIC | _STAT_DIRSIZE; #endif #endif /* Allocate the initial operate config */ config->first = malloc(sizeof(struct OperationConfig)); if(config->first) { /* Perform the libcurl initialization */ /* Perform the libcurl initialization */ result = curl_global_init(CURL_GLOBAL_DEFAULT); result = curl_global_init(CURL_GLOBAL_DEFAULT); if(!result) { if(!result) { /* Get information about libcurl */ /* Get information about libcurl */ result = get_libcurl_info(); result = get_libcurl_info(); if(result) if(!result) { helpf(config->errors, "error retrieving curl library information\n"); /* Initialise the config */ config_init(config->first); } else helpf(stderr, "error retrieving curl library information\n"); } } else else helpf(config->errors, "error initializing curl library\n"); helpf(stderr, "error initializing curl library\n"); } else { helpf(stderr, "error initializing curl\n"); result = CURLE_FAILED_INIT; } return result; return result; } } Loading @@ -163,8 +175,6 @@ int main(int argc, char *argv[]) { { CURLcode result = CURLE_OK; CURLcode result = CURLE_OK; struct GlobalConfig global; struct GlobalConfig global; struct OperationConfig *config; memset(&global, 0, sizeof(global)); memset(&global, 0, sizeof(global)); main_checkfds(); main_checkfds(); Loading @@ -176,36 +186,26 @@ int main(int argc, char *argv[]) /* Initialize memory tracking */ /* Initialize memory tracking */ memory_tracking_init(); memory_tracking_init(); /* Allocate the initial operate config */ config = malloc(sizeof(struct OperationConfig)); if(config) { /* Initialise the config */ config_init(config); /* Initialize the curl library - do not call any libcurl functions before /* Initialize the curl library - do not call any libcurl functions before this point */ this point */ result = main_init(config); result = main_init(&global); if(!result) { if(!result) { /* Start our curl operation */ /* Start our curl operation */ result = operate(config, argc, argv); result = operate(global.first, argc, argv); /* Perform the main cleanup */ /* Perform the main cleanup */ main_free(); main_free(); } } if(global.first) { #ifdef __SYMBIAN32__ #ifdef __SYMBIAN32__ if(config->showerror) if(global->first->showerror) tool_pressanykey(); tool_pressanykey(); #endif #endif /* Free the config structures */ /* Free the config structures */ config_free(config); config_free(global.first); config = NULL; global.first = NULL; } else { helpf(stderr, "error initializing curl\n"); result = CURLE_FAILED_INIT; } } #ifdef __NOVELL_LIBC__ #ifdef __NOVELL_LIBC__ Loading