likely unlikley support

This commit is contained in:
stmctommyau 2023-09-25 03:50:30 +08:00
parent 96dababb9c
commit 74611e422f

View File

@ -14,6 +14,10 @@
#include "dateNtime.h" #include "dateNtime.h"
#endif // !DNT_H #endif // !DNT_H
//linked list //linked list
#ifndef linkely
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#endif
typedef struct linkedlist{ typedef struct linkedlist{
struct linkedlist* next; struct linkedlist* next;
struct linkedlist* prev; struct linkedlist* prev;
@ -125,7 +129,7 @@ bool is_admin(char* role){
} }
char line[100]; char line[100];
while(fgets(line,100,fp) != NULL){ while(fgets(line,100,fp) != NULL){
if(line[0] == '#') continue; if(unlikely(line[0] == '#')) continue;
while(line[strlen(line)-1] == '\n' || (int)line[strlen(line)-1] == 13) while(line[strlen(line)-1] == '\n' || (int)line[strlen(line)-1] == 13)
line[strlen(line)-1] = '\0'; line[strlen(line)-1] = '\0';