优化类型名

This commit is contained in:
源文雨 2022-11-23 14:45:22 +08:00
parent a4a53d8a31
commit a813727662
2 changed files with 3 additions and 3 deletions

2
c302.c
View File

@ -6,7 +6,7 @@
#include <time.h>
#include "c302.h"
static void http_error(ERRCODE code, char* msg) {
static void http_error(errcode_enum_t code, char* msg) {
uint32_t len = strlen(msg) + typel[code];
char* str = malloc(len);
sprintf(str, types[code], msg);

4
c302.h
View File

@ -14,8 +14,8 @@
#define H500 "HTTP/1.0 500 Internal Server Error\r\nContent-Type: text/html\r\n\r\n<P>%s\r\n"
const char* types[] = {H400, H404, H500};
const uint8_t typel[] = {59, 111, 69};
enum ERRCODE {HTTP400, HTTP404, HTTP500};
typedef enum ERRCODE ERRCODE;
enum errcode_enum_t {HTTP400, HTTP404, HTTP500};
typedef enum errcode_enum_t errcode_enum_t;
static const char* urls[] = {
"https://bocchi.rocks/assets/img/page/character/hitori/main.png", // 後藤ひとり