Skip to content

Commit

Permalink
Merge pull request #18 from chaos/cleanup
Browse files Browse the repository at this point in the history
fix tab vs space
  • Loading branch information
chu11 authored Nov 19, 2023
2 parents 71e290c + 3fc309c commit 1c829ee
Show file tree
Hide file tree
Showing 17 changed files with 237 additions and 237 deletions.
164 changes: 82 additions & 82 deletions src/libnodeupdown/nodeupdown.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,72 +415,72 @@ nodeupdown_load_data(nodeupdown_t handle,
if (port <= 0)
{
if (conffile_config.port_flag)
{
if (conffile_config.port <= 0)
{
handle->errnum = NODEUPDOWN_ERR_CONF_INPUT;
goto cleanup;
}
port = conffile_config.port;
}
{
if (conffile_config.port <= 0)
{
handle->errnum = NODEUPDOWN_ERR_CONF_INPUT;
goto cleanup;
}
port = conffile_config.port;
}
else if (module_config.port_flag)
{
if (module_config.port <= 0)
{
handle->errnum = NODEUPDOWN_ERR_CONFIG_MODULE;
goto cleanup;
}
port = module_config.port;
}
{
if (module_config.port <= 0)
{
handle->errnum = NODEUPDOWN_ERR_CONFIG_MODULE;
goto cleanup;
}
port = module_config.port;
}
else
{
if (backend_module_default_port(handle) <= 0)
{
handle->errnum = NODEUPDOWN_ERR_BACKEND_MODULE;
goto cleanup;
}
port = backend_module_default_port(handle);
}
{
if (backend_module_default_port(handle) <= 0)
{
handle->errnum = NODEUPDOWN_ERR_BACKEND_MODULE;
goto cleanup;
}
port = backend_module_default_port(handle);
}
}

if (timeout_len <= 0)
{
if (conffile_config.timeout_len_flag)
{
if (conffile_config.timeout_len <= 0)
{
handle->errnum = NODEUPDOWN_ERR_CONF_INPUT;
goto cleanup;
}
timeout_len = conffile_config.timeout_len;
}
{
if (conffile_config.timeout_len <= 0)
{
handle->errnum = NODEUPDOWN_ERR_CONF_INPUT;
goto cleanup;
}
timeout_len = conffile_config.timeout_len;
}
else if (module_config.timeout_len_flag)
{
if (module_config.timeout_len <= 0)
{
handle->errnum = NODEUPDOWN_ERR_CONFIG_MODULE;
goto cleanup;
}
timeout_len = module_config.timeout_len;
}
{
if (module_config.timeout_len <= 0)
{
handle->errnum = NODEUPDOWN_ERR_CONFIG_MODULE;
goto cleanup;
}
timeout_len = module_config.timeout_len;
}
else
{
if (backend_module_default_timeout_len(handle) < 0)
{
handle->errnum = NODEUPDOWN_ERR_BACKEND_MODULE;
goto cleanup;
}
timeout_len = backend_module_default_timeout_len(handle);
}
{
if (backend_module_default_timeout_len(handle) < 0)
{
handle->errnum = NODEUPDOWN_ERR_BACKEND_MODULE;
goto cleanup;
}
timeout_len = backend_module_default_timeout_len(handle);
}
}

if (hostname)
{
if (backend_module_get_updown_data(handle,
hostname,
port,
timeout_len,
module) < 0)
hostname,
port,
timeout_len,
module) < 0)
goto cleanup;
}
else if (conffile_config.hostnames_flag || module_config.hostnames_flag)
Expand All @@ -489,25 +489,25 @@ nodeupdown_load_data(nodeupdown_t handle,
int i, hostnames_len;

if (conffile_config.hostnames_flag)
{
hostnames = conffile_config.hostnames;
hostnames_len = conffile_config.hostnames_len;
}
{
hostnames = conffile_config.hostnames;
hostnames_len = conffile_config.hostnames_len;
}
else
{
hostnames = module_config.hostnames;
hostnames_len = module_config.hostnames_len;
}
{
hostnames = module_config.hostnames;
hostnames_len = module_config.hostnames_len;
}

for (i = 0; i < hostnames_len; i++)
{
if (strlen(hostnames[i]) > 0)
{
if (backend_module_get_updown_data(handle,
hostnames[i],
port,
timeout_len,
module) < 0)
hostnames[i],
port,
timeout_len,
module) < 0)
continue;
else
break;
Expand All @@ -528,10 +528,10 @@ nodeupdown_load_data(nodeupdown_t handle,
goto cleanup;

if (backend_module_get_updown_data(handle,
hostnamePtr,
port,
timeout_len,
module) < 0)
hostnamePtr,
port,
timeout_len,
module) < 0)
goto cleanup;
}

Expand Down Expand Up @@ -745,19 +745,19 @@ _is_node(nodeupdown_t handle, const char *node, int up_or_down)
if (clusterlist_module_found)
{
if ((rv = clusterlist_module_is_node_in_cluster(handle, node)) < 0)
return -1;
return -1;

if (!rv)
{
handle->errnum = NODEUPDOWN_ERR_NOTFOUND;
return -1;
}
{
handle->errnum = NODEUPDOWN_ERR_NOTFOUND;
return -1;
}

if (clusterlist_module_get_nodename(handle,
node,
buffer,
NODEUPDOWN_MAXNODENAMELEN+1) < 0)
return -1;
node,
buffer,
NODEUPDOWN_MAXNODENAMELEN+1) < 0)
return -1;

nodePtr = buffer;
}
Expand All @@ -767,11 +767,11 @@ _is_node(nodeupdown_t handle, const char *node, int up_or_down)
* loaded.
*/
if (hostlist_find(handle->up_nodes, node) < 0
&& hostlist_find(handle->down_nodes, node) < 0)
{
handle->errnum = NODEUPDOWN_ERR_NOTFOUND;
return -1;
}
&& hostlist_find(handle->down_nodes, node) < 0)
{
handle->errnum = NODEUPDOWN_ERR_NOTFOUND;
return -1;
}

nodePtr = (char *)node;
}
Expand Down
8 changes: 4 additions & 4 deletions src/libnodeupdown/nodeupdown/nodeupdown_backend_module.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ typedef int (*Nodeupdown_backend_cleanup)(nodeupdown_t);
* Returns 0 on success, -1 on error
*/
typedef int (*Nodeupdown_backend_get_updown_data)(nodeupdown_t,
const char *,
unsigned int,
unsigned int,
char *);
const char *,
unsigned int,
unsigned int,
char *);

/*
* struct nodeupdown_backend_module_info
Expand Down
8 changes: 4 additions & 4 deletions src/libnodeupdown/nodeupdown/nodeupdown_clusterlist_module.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ typedef int (*Nodeupdown_clusterlist_get_numnodes)(nodeupdown_t);
* Returns 1 is node is in the cluster, 0 if not, -1 on error
*/
typedef int (*Nodeupdown_clusterlist_is_node_in_cluster)(nodeupdown_t,
const char *);
const char *);

/*
* Nodeupdown_clusterlist_get_nodename
Expand All @@ -78,9 +78,9 @@ typedef int (*Nodeupdown_clusterlist_is_node_in_cluster)(nodeupdown_t,
* Returns nodename in buffer, 0 on success, -1 on error
*/
typedef int (*Nodeupdown_clusterlist_get_nodename)(nodeupdown_t,
const char *,
char *,
unsigned int);
const char *,
char *,
unsigned int);

/*
* Nodeupdown_clusterlist_compare_to_clusterlist
Expand Down
2 changes: 1 addition & 1 deletion src/libnodeupdown/nodeupdown/nodeupdown_config_module.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ typedef int (*Nodeupdown_config_cleanup)(nodeupdown_t);
* Returns 0 on success, -1 on error
*/
typedef int (*Nodeupdown_config_load_config)(nodeupdown_t,
struct nodeupdown_config *);
struct nodeupdown_config *);

/*
* struct nodeupdown_config_module_info
Expand Down
32 changes: 16 additions & 16 deletions src/libnodeupdown/nodeupdown_backend_cerebro.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ cerebro_backend_cleanup(nodeupdown_t handle)
{
#ifndef NDEBUG
fprintf(stderr, "cerebro_handle_destroy: %s\n",
cerebro_strerror(cerebro_errnum(cerebro_handle)));
cerebro_strerror(cerebro_errnum(cerebro_handle)));
#endif /* NDEBUG */
nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_BACKEND_MODULE);
return -1;
Expand Down Expand Up @@ -177,7 +177,7 @@ cerebro_backend_get_updown_data(nodeupdown_t handle,
{
#ifndef NDEBUG
fprintf(stderr, "cerebro_set_hostname: %s\n",
cerebro_strerror(cerebro_errnum(cerebro_handle)));
cerebro_strerror(cerebro_errnum(cerebro_handle)));
#endif /* NDEBUG */
nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_BACKEND_MODULE);
return -1;
Expand All @@ -187,7 +187,7 @@ cerebro_backend_get_updown_data(nodeupdown_t handle,
{
#ifndef NDEBUG
fprintf(stderr, "cerebro_set_port: %s\n",
cerebro_strerror(cerebro_errnum(cerebro_handle)));
cerebro_strerror(cerebro_errnum(cerebro_handle)));
#endif /* NDEBUG */
nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_BACKEND_MODULE);
return -1;
Expand All @@ -197,7 +197,7 @@ cerebro_backend_get_updown_data(nodeupdown_t handle,
{
#ifndef NDEBUG
fprintf(stderr, "cerebro_set_timeout_len: %s\n",
cerebro_strerror(cerebro_errnum(cerebro_handle)));
cerebro_strerror(cerebro_errnum(cerebro_handle)));
#endif /* NDEBUG */
nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_BACKEND_MODULE);
return -1;
Expand All @@ -208,7 +208,7 @@ cerebro_backend_get_updown_data(nodeupdown_t handle,
{
#ifndef NDEBUG
fprintf(stderr, "cerebro_get_metric_data: %s\n",
cerebro_strerror(cerebro_errnum(cerebro_handle)));
cerebro_strerror(cerebro_errnum(cerebro_handle)));
#endif /* NDEBUG */
if (cerebro_errnum(cerebro_handle) == CEREBRO_ERR_CONNECT)
nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_CONNECT);
Expand All @@ -225,7 +225,7 @@ cerebro_backend_get_updown_data(nodeupdown_t handle,
{
#ifndef NDEBUG
fprintf(stderr, "cerebro_nodelist_iterator_create: %s\n",
cerebro_strerror(cerebro_errnum(cerebro_handle)));
cerebro_strerror(cerebro_errnum(cerebro_handle)));
#endif /* NDEBUG */
nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_BACKEND_MODULE);
goto cleanup;
Expand All @@ -241,8 +241,8 @@ cerebro_backend_get_updown_data(nodeupdown_t handle,
if (cerebro_nodelist_iterator_nodename(itr, &nodename) < 0)
{
#ifndef NDEBUG
fprintf(stderr, "cerebro_nodelist_iterator_nodename: %s\n",
cerebro_strerror(cerebro_errnum(cerebro_handle)));
fprintf(stderr, "cerebro_nodelist_iterator_nodename: %s\n",
cerebro_strerror(cerebro_errnum(cerebro_handle)));
#endif /* NDEBUG */
nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_BACKEND_MODULE);
goto cleanup;
Expand All @@ -251,7 +251,7 @@ cerebro_backend_get_updown_data(nodeupdown_t handle,
if (!nodename)
{
#ifndef NDEBUG
fprintf(stderr, "cerebro_nodelist_iterator_create: null nodename\n");
fprintf(stderr, "cerebro_nodelist_iterator_create: null nodename\n");
#endif /* NDEBUG */
nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_BACKEND_MODULE);
goto cleanup;
Expand All @@ -264,8 +264,8 @@ cerebro_backend_get_updown_data(nodeupdown_t handle,
&mvalue) < 0)
{
#ifndef NDEBUG
fprintf(stderr, "cerebro_nodelist_iterator_metric_value: %s\n",
cerebro_strerror(cerebro_errnum(cerebro_handle)));
fprintf(stderr, "cerebro_nodelist_iterator_metric_value: %s\n",
cerebro_strerror(cerebro_errnum(cerebro_handle)));
#endif /* NDEBUG */
nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_BACKEND_MODULE);
goto cleanup;
Expand All @@ -278,7 +278,7 @@ cerebro_backend_get_updown_data(nodeupdown_t handle,
#endif /* !CEREBRO_METRIC_VALUE_TYPE_U_INT32 */
{
#ifndef NDEBUG
fprintf(stderr, "cerebro_nodelist_iterator_metric_value: invalid mtype: %u\n", mtype);
fprintf(stderr, "cerebro_nodelist_iterator_metric_value: invalid mtype: %u\n", mtype);
#endif /* NDEBUG */
nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_BACKEND_MODULE);
goto cleanup;
Expand All @@ -287,7 +287,7 @@ cerebro_backend_get_updown_data(nodeupdown_t handle,
if (mlen != sizeof(u_int32_t))
{
#ifndef NDEBUG
fprintf(stderr, "cerebro_nodelist_iterator_metric_value: invalid mlen: %u\n", mlen);
fprintf(stderr, "cerebro_nodelist_iterator_metric_value: invalid mlen: %u\n", mlen);
#endif /* NDEBUG */
nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_BACKEND_MODULE);
goto cleanup;
Expand All @@ -312,8 +312,8 @@ cerebro_backend_get_updown_data(nodeupdown_t handle,
if (cerebro_nodelist_iterator_next(itr) < 0)
{
#ifndef NDEBUG
fprintf(stderr, "cerebro_nodelist_iterator_next: %s\n",
cerebro_strerror(cerebro_errnum(cerebro_handle)));
fprintf(stderr, "cerebro_nodelist_iterator_next: %s\n",
cerebro_strerror(cerebro_errnum(cerebro_handle)));
#endif /* NDEBUG */
nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_BACKEND_MODULE);
goto cleanup;
Expand All @@ -324,7 +324,7 @@ cerebro_backend_get_updown_data(nodeupdown_t handle,
{
#ifndef NDEBUG
fprintf(stderr, "cerebro_nodelist_iterator_at_end: %s\n",
cerebro_strerror(cerebro_errnum(cerebro_handle)));
cerebro_strerror(cerebro_errnum(cerebro_handle)));
#endif /* NDEBUG */
nodeupdown_set_errnum(handle, NODEUPDOWN_ERR_BACKEND_MODULE);
goto cleanup;
Expand Down
Loading

0 comments on commit 1c829ee

Please sign in to comment.