C Collections

chttpserver · Section 3

chttpsvr_req_query_oom

chttpsvr_req_query_oom - check whether chttpsvr_req_query ran out of memory

C Collections (libccollections, -lccollections)

#include <ccollections/chttpserver.h>
 
bool chttpsvr_req_query_oom(const chttpsvr_req *req);

Returns true when an allocation for the query string of this request
failed for lack of memory.  Two allocations can fail like that: The
growth of the result array inside chttpsvr_req_query, and the shared
parse of the query string, which runs once and which
chttpsvr_req_query and chttpsvr_req_query_one start lazily on their
first use.
 
chttpsvr_req_query returns NULL with a count of 0 both for an absent
key and when it could not build the result array for lack of memory.
After any NULL from chttpsvr_req_query, call this function to find
out which of the two happened.
 
Once the flag is set it stays true for the rest of the request,
whatever query calls follow.  For a NULL req the function returns
false.

true; an allocation for the query string of this request failed out of
memory.
false; no allocation error happened, or req is NULL.

chttpsvr_req_query(3), chttpsvr_req_query_one(3)