Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Remove check_node function
Signed-off-by: Michał Pokrywka <michal.pokrywka@gmail.com>
  • Loading branch information
mpokrywka committed Mar 2, 2011
1 parent a8c0eb3 commit 3193a18
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions mod_upload_progress.c
Expand Up @@ -407,10 +407,6 @@ static const char *get_json_callback_param(request_rec *r, int *param_error) {
return NULL;
}

static inline int check_node(upload_progress_node_t *node, const char *key) {
return strncasecmp(node->key, key, ARG_MAXLEN_PROGRESSID) == 0 ? 1 : 0;
}

static void fill_new_upload_node_data(upload_progress_node_t *node, request_rec *r) {
const char *content_length;
time_t t = time(NULL);
Expand Down Expand Up @@ -460,7 +456,7 @@ static upload_progress_node_t *find_node(server_rec *server, const char *key) {

for (i = 0; i < active; i++) {
node = &nodes[list[i]];
if (check_node(node, key))
if (strncasecmp(node->key, key, ARG_MAXLEN_PROGRESSID) == 0)
return node;
}
return NULL;
Expand Down

1 comment on commit 3193a18

@BenBE
Copy link

@BenBE BenBE commented on 3193a18 Jul 15, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't quite like this commit (even though it is completely legal to do it) because of the source decentralization on node key checks.

The inline directive on the original check_node function had exactly the same effect even if the resulting code would have been a few instruction longer. Those additional instructions where to make the return value a bit more deterministic but would be optimized away by the compiler thus in actual usage of this function there'd be no difference.

Also keeping this function would allow for better sanity checking when retrieving keys (using the check_node functions for code assertions).

Please sign in to comment.