-
Couldn't load subscription status.
- Fork 9
Allocating memory by using built in allocation pool
Taymindis Woon edited this page Jan 9, 2019
·
8 revisions
fcgi Function has built in allocation memory management, it will be auto free for every session request.
Sample:
void getProfile(ffunc_session_t * session) {
int* newId = (int*)ffunc_alloc(session, sizeof(int));
flog_info("%s\n", "you reach here with get Request");
if (session->query_str) {
char *userID = (char*) ffunc_get_query_param(session, "userId", sizeof("userId") - 1);
if (userID) {
*newId = atoi(userID);
write_out("This user %s has new id= %d\n", userID, *newId); // the param @userId
}
}
}