9aa2d973eed1fc49b9a79bf3f45ecf9560c7657a galt Tue Jan 16 13:53:25 2018 -0800 Adding similar functions for storing a char in a pointer, useful with our hashes if you have simple char data. diff --git src/inc/obscure.h src/inc/obscure.h index a99aff1..3ce3323 100644 --- src/inc/obscure.h +++ src/inc/obscure.h @@ -41,30 +41,38 @@ int countWordsInFile(char *fileName); /* Count number of words in file. */ struct slName *readAllLines(char *fileName); /* Read all lines of file into a list. (Removes trailing carriage return.) */ void copyFile(char *source, char *dest); /* Copy file from source to dest. */ void copyOpenFile(FILE *inFh, FILE *outFh); /* copy an open stdio file */ void cpFile(int s, int d); /* Copy from source file to dest until reach end of file. */ +void *charToPt(char c); +/* Convert char to pointer. Use when really want to store + * a char in a pointer field. */ + +char ptToChar(void *pt); +/* Convert pointer to char. Use when really want to store a + * pointer in a char. */ + void *intToPt(int i); /* Convert integer to pointer. Use when really want to store an * int in a pointer field. */ int ptToInt(void *pt); /* Convert pointer to integer. Use when really want to store a * pointer in an int. */ void *sizetToPt(size_t i); /* Convert size_t to pointer. Use when really want to store a * size_t in a pointer. */ size_t ptToSizet(void *pt); /* Convert pointer to size_t. Use when really want to store a * pointer in a size_t. */