qlic_private.h (622B)
1 #ifndef __QLIC_PRIVATE_H 2 #define __QLIC_PRIVATE_H 3 4 #define QLIC_FILE_BUFFER_SIZE 256 5 /// @todo this can be optimized based on the cpu 6 7 #define QLIC_PANIC() \ 8 fprintf(stderr, "qlick panicked at %s:%d", __FILE__, __LINE__); \ 9 exit(-1); 10 11 #define __QLIC_ASSIGN_STRING(X,Y) \ 12 if (X == NULL) { \ 13 if ((X = init_qlic_string()) == NULL) { \ 14 QLIC_PANIC(); \ 15 } \ 16 } \ 17 X->len = strlen(Y); \ 18 X->string = (char*)malloc(sizeof(char) * (X->len + 2)); \ 19 void* __LINE__ptr = strncpy(X->string, Y, X->len); \ 20 if (__LINE__ptr == NULL) { \ 21 qlic_error("%d in %s failed\n __LINE__ - 2, __FILE__"); \ 22 QLIC_PANIC(); \ 23 } 24 25 #endif