X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=src%2Fcommon%2Freadwrite.h;h=ce7b749bc251c9ebea8f6be257b230b74ca0cb35;hb=bcb73daf6f90c4356bdbeba5783a493e941a2519;hp=c151f135925edb7bbfc952e8d784902d73317bae;hpb=2b2a1e0169b3a863fd87b679d789a4e2b789eb67;p=plomrogue diff --git a/src/common/readwrite.h b/src/common/readwrite.h index c151f13..ce7b749 100644 --- a/src/common/readwrite.h +++ b/src/common/readwrite.h @@ -53,20 +53,13 @@ extern void detect_atomic_leftover(char * path); /* Return largest line length from "file" (including newline chars). */ extern uint32_t textfile_width(FILE * file); -/* Read "file" for load of bytes to put onto "queue" of "queue_size" (growing - * that size). May put many \0-terminated strings on the queue at once. \n chars - * are replaced with \0 chars. If the queue doesn't end in \0, a \o byte is - * appended to it. Returns 1 if reading succeeds, 0 if nothing is read. - */ -extern uint8_t read_file_into_queue(FILE * file, char ** queue, - uint32_t * queue_size); +/* Read "file" for load of non-zero bytes to put onto "queue" string. */ +extern uint8_t read_file_into_queue(FILE * file, char ** queue); -/* Cut out and return first \0-terminated string from "queue" and appropriately - * reduce "queue_size". Return NULL if queue is empty. Superfluous \0 bytes - * after the string are also cut out. Should the queue start with \0 bytes, - * those are cut out before returning anything after them. +/* Return message from "queue" (identified as \n-delimited string, with \n as + * \0 in the returned message; return nothing if no \n delimiter found). */ -extern char * get_message_from_queue(char ** queue, uint32_t * queue_size); +extern char * get_message_from_queue(char ** queue);