Changeset 0b0bb4c


Ignore:
Timestamp:
2015-10-08T05:10:19Z (9 years ago)
Author:
dequis <dx@…>
Branches:
master
Children:
687ec88
Parents:
098b430
git-author:
Artem Savkov <asavkov@…> (07-10-15 13:13:34)
git-committer:
dequis <dx@…> (08-10-15 05:10:19)
Message:

Allow NULL callback functions in http_dorequest

Check callback function supplied to http_dorequest and only run it if it is
not NULL.

While it is not the usual case there are some times when there is no need to
check the results of a http request. Using a NULL pointer is much more
convenient than creating noop functions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/http_client.c

    r098b430 r0b0bb4c  
    162162        }
    163163
    164         req->func(req);
     164        if (req->func != NULL) {
     165                req->func(req);
     166        }
    165167        http_free(req);
    166168        return FALSE;
     
    299301        }
    300302
    301         req->func(req);
     303        if (req->func != NULL) {
     304                req->func(req);
     305        }
    302306        http_free(req);
    303307        return FALSE;
     
    412416        }
    413417
    414         if ((req->flags & HTTPC_STREAMING) && req->reply_body) {
     418        if ((req->flags & HTTPC_STREAMING) && req->reply_body && req->func != NULL) {
    415419                req->func(req);
    416420        }
Note: See TracChangeset for help on using the changeset viewer.