Browse Source

[core] macros CONST_LEN_STR and CONST_STR_LEN

personal/stbuehler/ci-build
Glenn Strauss 3 years ago
parent
commit
be04c1239f
  1. 3
      src/buffer.h
  2. 1
      src/http_header.c
  3. 2
      src/http_kv.c

3
src/buffer.h

@ -214,7 +214,8 @@ void buffer_append_path_len(buffer *b, const char *a, size_t alen); /* join stri
#define BUFFER_INTLEN_PTR(x) (x)->used ? (int)((x)->used - 1) : 0, (x)->ptr
#define CONST_STR_LEN(x) x, (x) ? sizeof(x) - 1 : 0
#define CONST_LEN_STR(x) (uint32_t)sizeof(x)-1, x
#define CONST_STR_LEN(x) x, (uint32_t)sizeof(x) - 1
#define CONST_BUF_LEN(x) ((x) ? (x)->ptr : NULL), buffer_string_length(x)

1
src/http_header.c

@ -19,7 +19,6 @@ typedef struct keyvlenvalue {
int8_t http_headers_off[] = {
-1, -1, -1, -1, 0, 4, 5, 9, 10, 11, 12, -1, 15, 16, 20, 21, 23, 25
};
#define CONST_LEN_STR(x) (unsigned int)(sizeof(x)-1), x
static const keyvlenvalue http_headers[] = {
{ HTTP_HEADER_HOST, CONST_LEN_STR("Host") }
,{ HTTP_HEADER_DATE, CONST_LEN_STR("Date") }

2
src/http_kv.c

@ -5,8 +5,6 @@
#include <string.h>
#define CONST_LEN_STR(x) (unsigned int)sizeof(x)-1, (x)
typedef struct {
int key;
unsigned int vlen;

Loading…
Cancel
Save