ref: e92edee06026db966b9c7a547fbef413d9610cdc
parent: f95ddbe45db70bf58be577607142ba9fa5a77843
author: cancel <cancel@cancel.fm>
date: Mon Jan 6 22:00:41 EST 2020
Cleanup naming
--- a/prefs.c
+++ b/prefs.c
@@ -2,9 +2,9 @@
#include <ctype.h>
ORCA_FORCE_NO_INLINE
-Readprefs_result prefs_read_line(FILE* file, char* buf, Usz bufsize,
- char** out_left, Usz* out_leftsize,
- char** out_right, Usz* out_rightsize) {
+Conf_read_result conf_read_line(FILE* file, char* buf, Usz bufsize,
+ char** out_left, Usz* out_leftsize,
+ char** out_right, Usz* out_rightsize) {
Usz len, a0, a1, b0, b1;
char* s;
if (bufsize < 2)
@@ -77,15 +77,15 @@
}
b1 = x;
}
- Readprefs_result err;
+ Conf_read_result err;
insufficient_buffer:
- err = Readprefs_buffer_too_small;
+ err = Conf_read_buffer_too_small;
goto fail;
eof:
- err = Readprefs_eof;
+ err = Conf_read_eof;
goto fail;
ioerror:
- err = Readprefs_io_error;
+ err = Conf_read_io_error;
goto fail;
fail:
*out_left = NULL;
@@ -95,7 +95,7 @@
s[len - 1] = '\0';
*out_left = s;
*out_leftsize = len;
- err = Readprefs_irrelevant;
+ err = Conf_read_irrelevant;
goto no_right;
no_right:
*out_right = NULL;
@@ -108,5 +108,5 @@
*out_leftsize = a1 - a0;
*out_right = s + b0;
*out_rightsize = b1 - b0;
- return Readprefs_left_and_right;
+ return Conf_read_left_and_right;
}
--- a/prefs.h
+++ b/prefs.h
@@ -3,13 +3,13 @@
#include <stdio.h> // FILE cannot be forward declared
typedef enum {
- Readprefs_left_and_right = 0, // left and right will be set
- Readprefs_irrelevant, // only left will be set
- Readprefs_buffer_too_small, // neither will be set
- Readprefs_eof, // "
- Readprefs_io_error, // "
-} Readprefs_result;
+ Conf_read_left_and_right = 0, // left and right will be set
+ Conf_read_irrelevant, // only left will be set
+ Conf_read_buffer_too_small, // neither will be set
+ Conf_read_eof, // "
+ Conf_read_io_error, // "
+} Conf_read_result;
-Readprefs_result prefs_read_line(FILE* file, char* buf, Usz bufsize,
- char** out_left, Usz* out_leftlen,
- char** out_right, Usz* out_rightlen);
+Conf_read_result conf_read_line(FILE* file, char* buf, Usz bufsize,
+ char** out_left, Usz* out_leftlen,
+ char** out_right, Usz* out_rightlen);