summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2016-08-28 15:35:37 -0400
committerPaul Duncan <pabs@pablotron.org>2016-08-28 15:35:37 -0400
commitb477f7b16f4b7a08d6eaf7f2b6093f14a13123ea (patch)
tree06d140d5feb5e96d03912b6045c2543ed0c92b5c
parent843b3f2ced993fab157cfdd6e55b10ce8dfa13a7 (diff)
downloadlibfhp-b477f7b16f4b7a08d6eaf7f2b6093f14a13123ea.tar.bz2
libfhp-b477f7b16f4b7a08d6eaf7f2b6093f14a13123ea.zip
reorganize methods
-rw-r--r--ctx.c72
1 files changed, 40 insertions, 32 deletions
diff --git a/ctx.c b/ctx.c
index e73fba8..3f2f98f 100644
--- a/ctx.c
+++ b/ctx.c
@@ -1,40 +1,9 @@
#include "internal.h"
//
-// context functions
+// context buffer functions
//
-static const fhp_ctx_t FHP_DEFAULT_CONTEXT = {
- .state = FHP_STATE_INIT,
- .user_data = NULL,
- .cb = NULL,
- .err = FHP_OK,
- .ofs = 0,
- .buf_len = 0,
- .is_hashing = false,
- .header_name_hash = 0,
- .header_value_parser = FHP_HEADER_VALUE_PARSER_NONE,
- .body_type = FHP_BODY_TYPE_NONE,
- .content_length = 0,
- .num_tes = 0,
-};
-
-fhp_err_t
-fhp_ctx_init(
- fhp_ctx_t * const ctx,
- fhp_env_t * const env,
- fhp_cb_t cb,
- void * const user_data
-) {
- *ctx = FHP_DEFAULT_CONTEXT;
- ctx->env = env ? env : fhp_get_default_env();
- ctx->user_data = user_data;
- ctx->cb = cb;
-
- /* return success */
- return FHP_OK;
-}
-
static void
fhp_ctx_buf_clear(fhp_ctx_t * const ctx) {
// clear buffer
@@ -89,6 +58,10 @@ fhp_ctx_buf_push(
return FHP_OK;
}
+//
+// method functions
+//
+
static fhp_err_t
fhp_ctx_handle_method(fhp_ctx_t * const ctx) {
// get method token
@@ -115,6 +88,41 @@ fhp_ctx_handle_method(fhp_ctx_t * const ctx) {
return FHP_OK;
}
+//
+// context functions
+//
+
+static const fhp_ctx_t FHP_DEFAULT_CONTEXT = {
+ .state = FHP_STATE_INIT,
+ .user_data = NULL,
+ .cb = NULL,
+ .err = FHP_OK,
+ .ofs = 0,
+ .buf_len = 0,
+ .is_hashing = false,
+ .header_name_hash = 0,
+ .header_value_parser = FHP_HEADER_VALUE_PARSER_NONE,
+ .body_type = FHP_BODY_TYPE_NONE,
+ .content_length = 0,
+ .num_tes = 0,
+};
+
+fhp_err_t
+fhp_ctx_init(
+ fhp_ctx_t * const ctx,
+ fhp_env_t * const env,
+ fhp_cb_t cb,
+ void * const user_data
+) {
+ *ctx = FHP_DEFAULT_CONTEXT;
+ ctx->env = env ? env : fhp_get_default_env();
+ ctx->user_data = user_data;
+ ctx->cb = cb;
+
+ /* return success */
+ return FHP_OK;
+}
+
static fhp_err_t
fhp_ctx_push_byte(
fhp_ctx_t * const ctx,