summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2020-08-15 15:50:16 +0200
committerAki <please@ignore.pl>2020-08-15 15:50:16 +0200
commitcf22b1adbbe2e1de5073dcf44b7667a9665a20bf (patch)
treefb34abb89f5fa718473ce4d17efe8a32e317d9d6
parent87da5e359749cd01ff7a264fc2c15f8615ea80fd (diff)
downloadplop-cf22b1adbbe2e1de5073dcf44b7667a9665a20bf.zip
plop-cf22b1adbbe2e1de5073dcf44b7667a9665a20bf.tar.gz
plop-cf22b1adbbe2e1de5073dcf44b7667a9665a20bf.tar.bz2
Added PROCEED_TO macro
-rw-r--r--request.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/request.c b/request.c
index 3e67ff8..6039f56 100644
--- a/request.c
+++ b/request.c
@@ -155,12 +155,17 @@ static int read_rest_of_line(struct request * request)
return 0;
}
+#define PROCEED_TO(_x) \
+ request->temp.start = 0; \
+ request->temp.length = 0; \
+ request->step = _x; \
+ return _x(request)
+
/// Parses method field of the request.
/// \param request Request to process
/// \return -1 if an error has occured, 0 if too little data available or total number of bytes processed
int parse_step_method(struct request * request)
{
- request->temp.start = 0;
// TODO: Consider reworking read_* functions to be more aware of word boundaries.
request->temp.length = read_until_char(request, ' ');
@@ -171,8 +176,7 @@ int parse_step_method(struct request * request)
lua_pushlstring(request->lua, request->data + request->temp.start, request->temp.length);
- request->step = parse_step_path;
- return parse_step_path(request);
+ PROCEED_TO(parse_step_path);
}
/// Parses path field of the request.