C Collections

chttpserver · Section 3

chttpsvr_construct_scoped

chttpsvr_construct_scoped - declare a chttpsvr handle, initialize it, and destroy it automatically

C Collections (libccollections, -lccollections)

#include <ccollections/chttpserver.h>
 
chttpsvr_construct_scoped(name, cl);

Does what chttpsvr_declare_scoped does and then calls
chttpsvr_create(cl, &err), where err is an error string that the
macro keeps for itself.  Since name carries a GCC cleanup attribute,
the server is destroyed in the same way as chttpsvr_destroy destroys
it once name goes out of scope.  If the create fails, the macro calls
ccol__fatal_err() with a message that names the variable and carries
that error string, and it does not return.

name     The identifier for the new handle variable.
cl       The parent logger.  The server derives its own logger from
         it.  With CLOG_NULL the server uses an internal logger
         that writes only FATAL messages to stderr; see
         chttpsvr_create_mp for the details.

chttpsvr_construct(3), chttpsvr_declare_scoped(3)