A small lightweight http server library in c
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore: add explicit fallthrough to lexer

+17 -2
+17 -2
src/lexer.c
··· 87 87 ctx->state = PRAIRIE_LS_FIELD_NAME; 88 88 break; 89 89 } 90 + __attribute__((fallthrough)); 90 91 case ' ': 91 92 if (ctx->state == PRAIRIE_LS_METHOD) { 92 93 pop_acc(ctx, PRAIRIE_TOKEN_IDENTIFIER); ··· 98 99 ctx->state = PRAIRIE_LS_PROTOCOL; 99 100 break; 100 101 } 102 + __attribute__((fallthrough)); 101 103 case ':': 102 104 if (ctx->state == PRAIRIE_LS_FIELD_NAME) { 103 105 i++; ··· 106 108 ctx->state = PRAIRIE_LS_FIELD_VALUE; 107 109 break; 108 110 } 109 - default: 111 + __attribute__((fallthrough)); 112 + default: { 110 113 int acc_length = strlen(ctx->acc); 111 114 char *tmp = realloc(ctx->acc, acc_length + 2); 112 115 if (!tmp) { ··· 117 120 ctx->acc = tmp; 118 121 ctx->acc[acc_length] = raw_file[i]; 119 122 ctx->acc[acc_length + 1] = '\0'; 120 - break; 123 + 124 + } break; 121 125 } 122 126 } 123 127 ··· 127 131 prairie_token_t *start = ctx->token_start; 128 132 free(ctx); 129 133 return start; 134 + } 135 + 136 + void prairie_token_destroy(prairie_token_t *token_start) { 137 + prairie_token_t *token = token_start; 138 + 139 + while (token != NULL) { 140 + prairie_token_t *next = token->next; 141 + free(token); 142 + 143 + token = next; 144 + } 130 145 }