projects
/
liboping.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4442437
)
Refactor context_create().
author
Florian Forster
<ff@octo.it>
Thu, 4 May 2017 12:07:31 +0000
(14:07 +0200)
committer
Florian Forster
<ff@octo.it>
Thu, 4 May 2017 12:07:31 +0000
(14:07 +0200)
src/oping.c
patch
|
blob
|
history
diff --git
a/src/oping.c
b/src/oping.c
index
9ac87bf
..
adf769f
100644
(file)
--- a/
src/oping.c
+++ b/
src/oping.c
@@
-232,22
+232,17
@@
static void sigint_handler (int signal) /* {{{ */
opt_count = 0;
} /* }}} void sigint_handler */
opt_count = 0;
} /* }}} void sigint_handler */
-static ping_context_t *context_create (
void
) /* {{{ */
+static ping_context_t *context_create () /* {{{ */
{
{
- ping_context_t *ret;
-
- if ((ret = malloc (sizeof (ping_context_t))) == NULL)
+ ping_context_t *ctx = calloc (1, sizeof (*ctx));
+ if (ctx == NULL)
return (NULL);
return (NULL);
- memset (ret, '\0', sizeof (ping_context_t));
-
- ret->latency_total = 0.0;
-
#if USE_NCURSES
#if USE_NCURSES
-
ret
->window = NULL;
+
ctx
->window = NULL;
#endif
#endif
- return (
ret
);
+ return (
ctx
);
} /* }}} ping_context_t *context_create */
static void context_destroy (ping_context_t *context) /* {{{ */
} /* }}} ping_context_t *context_create */
static void context_destroy (ping_context_t *context) /* {{{ */