Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TLMSP curl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CYBER - Cyber Security
TS 103 523 MSP
TLMSP
TLMSP curl
Commits
b811200f
Commit
b811200f
authored
11 years ago
by
Steve Holme
Browse files
Options
Downloads
Patches
Plain Diff
tool_operate: Moved main initialisation and cleanup code into tool_main
parent
c1daf6c0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/tool_main.c
+39
-2
39 additions, 2 deletions
src/tool_main.c
src/tool_operate.c
+0
-13
0 additions, 13 deletions
src/tool_operate.c
src/tool_operhlp.c
+0
-26
0 additions, 26 deletions
src/tool_operhlp.c
src/tool_operhlp.h
+0
-4
0 additions, 4 deletions
src/tool_operhlp.h
with
39 additions
and
45 deletions
src/tool_main.c
+
39
−
2
View file @
b811200f
...
...
@@ -115,6 +115,32 @@ static void memory_tracking_init(void)
# define memory_tracking_init() Curl_nop_stmt
#endif
/*
* This is the main global constructor for the app. Call this before
* _any_ libcurl usage. If this fails, *NO* libcurl functions may be
* used, or havoc may be the result.
*/
static
CURLcode
main_init
(
void
)
{
#if defined(__DJGPP__) || defined(__GO32__)
/* stop stat() wasting time */
_djstat_flags
|=
_STAT_INODE
|
_STAT_EXEC_MAGIC
|
_STAT_DIRSIZE
;
#endif
return
curl_global_init
(
CURL_GLOBAL_DEFAULT
);
}
/*
* This is the main global destructor for the app. Call this after
* _all_ libcurl usage is done.
*/
static
void
main_free
(
void
)
{
curl_global_cleanup
();
convert_cleanup
();
metalink_cleanup
();
}
/*
** curl tool main function.
*/
...
...
@@ -139,8 +165,19 @@ int main(int argc, char *argv[])
/* Initialise the config */
init_config
(
config
);
/* Start our curl operation */
res
=
operate
(
config
,
argc
,
argv
);
/* Initialize the curl library - do not call any libcurl functions before
this point */
if
(
!
main_init
())
{
/* Start our curl operation */
res
=
operate
(
config
,
argc
,
argv
);
/* Perform the main cleanup */
main_free
();
}
else
{
helpf
(
config
->
errors
,
"error initializing curl library
\n
"
);
res
=
CURLE_FAILED_INIT
;
}
#ifdef __SYMBIAN32__
if
(
config
->
showerror
)
...
...
This diff is collapsed.
Click to expand it.
src/tool_operate.c
+
0
−
13
View file @
b811200f
...
...
@@ -214,19 +214,9 @@ int operate(struct Configurable *config, int argc, argv_item_t argv[])
heads
.
stream
=
stdout
;
heads
.
config
=
config
;
/*
** Initialize curl library - do not call any libcurl functions before
** this point.
*/
if
(
main_init
()
!=
CURLE_OK
)
{
helpf
(
config
->
errors
,
"error initializing curl library
\n
"
);
return
CURLE_FAILED_INIT
;
}
/* Get libcurl info right away */
if
(
get_libcurl_info
()
!=
CURLE_OK
)
{
helpf
(
config
->
errors
,
"error retrieving curl library information
\n
"
);
main_free
();
return
CURLE_FAILED_INIT
;
}
...
...
@@ -234,7 +224,6 @@ int operate(struct Configurable *config, int argc, argv_item_t argv[])
curl
=
curl_easy_init
();
if
(
!
curl
)
{
helpf
(
config
->
errors
,
"error initializing curl easy handle
\n
"
);
main_free
();
return
CURLE_FAILED_INIT
;
}
config
->
easy
=
curl
;
...
...
@@ -1892,7 +1881,5 @@ int operate(struct Configurable *config, int argc, argv_item_t argv[])
/* Release metalink related resources here */
clean_metalink
(
config
);
main_free
();
/* cleanup */
return
res
;
}
This diff is collapsed.
Click to expand it.
src/tool_operhlp.c
+
0
−
26
View file @
b811200f
...
...
@@ -193,29 +193,3 @@ CURLcode get_url_file_name(char **filename, const char *url)
return
CURLE_OK
;
}
/*
* This is the main global constructor for the app. Call this before
* _any_ libcurl usage. If this fails, *NO* libcurl functions may be
* used, or havoc may be the result.
*/
CURLcode
main_init
(
void
)
{
#if defined(__DJGPP__) || defined(__GO32__)
/* stop stat() wasting time */
_djstat_flags
|=
_STAT_INODE
|
_STAT_EXEC_MAGIC
|
_STAT_DIRSIZE
;
#endif
return
curl_global_init
(
CURL_GLOBAL_DEFAULT
);
}
/*
* This is the main global destructor for the app. Call this after
* _all_ libcurl usage is done.
*/
void
main_free
(
void
)
{
curl_global_cleanup
();
convert_cleanup
();
metalink_cleanup
();
}
This diff is collapsed.
Click to expand it.
src/tool_operhlp.h
+
0
−
4
View file @
b811200f
...
...
@@ -37,9 +37,5 @@ char *add_file_name_to_url(CURL *curl, char *url, const char *filename);
CURLcode
get_url_file_name
(
char
**
filename
,
const
char
*
url
);
CURLcode
main_init
(
void
);
void
main_free
(
void
);
#endif
/* HEADER_CURL_TOOL_OPERHLP_H */
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment