| 54 | } |
| 55 | |
| 56 | SDL_Surface* ttfTextHashStore(list_t* buckets, char* str, TTF_Font* font, bool outline, SDL_Surface* surf) |
| 57 | { |
| 58 | ttfTextHash_t* hashedVal; |
| 59 | node_t* node; |
| 60 | |
| 61 | // retrieve bucket |
| 62 | list_t* list = &buckets[djb2Hash(str) % HASH_SIZE]; |
| 63 | |
| 64 | // add surface to bucket |
| 65 | if ( (node = list_AddNodeFirst(list)) == NULL ) |
| 66 | { |
| 67 | return NULL; |
| 68 | } |
| 69 | else |
| 70 | { |
| 71 | hashedVal = (ttfTextHash_t*) malloc(sizeof(ttfTextHash_t)); |
| 72 | hashedVal->str = (char*) calloc(strlen(str) + 1, sizeof(char)); |
| 73 | strcpy(hashedVal->str, str); |
| 74 | hashedVal->surf = surf; |
| 75 | hashedVal->font = font; |
| 76 | hashedVal->outline = outline; |
| 77 | |
| 78 | node->deconstructor = &ttfTextHash_deconstructor; |
| 79 | node->size = sizeof(ttfTextHash_t); |
| 80 | node->element = hashedVal; |
| 81 | |
| 82 | return surf; |
| 83 | } |
| 84 | } |
nothing calls this directly
no test coverage detected