Rename getline_wrapped() to freadline_wrapped()

This commit is contained in:
Lucas De Marchi 2014-10-03 03:25:06 -03:00
parent b18979b770
commit aafd38359a
7 changed files with 11 additions and 11 deletions

View File

@ -595,7 +595,7 @@ static int kmod_config_parse(struct kmod_config *config, int fd,
return err;
}
while ((line = getline_wrapped(fp, &linenum)) != NULL) {
while ((line = freadline_wrapped(fp, &linenum)) != NULL) {
char *cmd, *saveptr;
if (line[0] == '\0' || line[0] == '#')

View File

@ -160,7 +160,7 @@ int read_str_ulong(int fd, unsigned long *value, int base)
* If linenum is not NULL, it is incremented by the number of physical lines
* which have been read.
*/
char *getline_wrapped(FILE *fp, unsigned int *linenum)
char *freadline_wrapped(FILE *fp, unsigned int *linenum)
{
int size = 256;
int i = 0, n = 0;

View File

@ -22,7 +22,7 @@ ssize_t read_str_safe(int fd, char *buf, size_t buflen) _must_check_ __attribute
ssize_t write_str_safe(int fd, const char *buf, size_t buflen) __attribute__((nonnull(2)));
int read_str_long(int fd, long *value, int base) _must_check_ __attribute__((nonnull(2)));
int read_str_ulong(int fd, unsigned long *value, int base) _must_check_ __attribute__((nonnull(2)));
char *getline_wrapped(FILE *fp, unsigned int *linenum) __attribute__((nonnull(1)));
char *freadline_wrapped(FILE *fp, unsigned int *linenum) __attribute__((nonnull(1)));
/* path handling functions */
/* ************************************************************************ */

View File

@ -70,16 +70,16 @@ static DEFINE_TEST(alias_1,
.out = TESTSUITE_ROOTFS "test-util/alias-correct.txt",
});
static int test_getline_wrapped(const struct test *t)
static int test_freadline_wrapped(const struct test *t)
{
FILE *fp = fopen("/getline_wrapped-input.txt", "re");
FILE *fp = fopen("/freadline_wrapped-input.txt", "re");
if (!fp)
return EXIT_FAILURE;
while (!feof(fp) && !ferror(fp)) {
unsigned int num = 0;
char *s = getline_wrapped(fp, &num);
char *s = freadline_wrapped(fp, &num);
if (!s)
break;
puts(s);
@ -90,19 +90,19 @@ static int test_getline_wrapped(const struct test *t)
fclose(fp);
return EXIT_SUCCESS;
}
static DEFINE_TEST(test_getline_wrapped,
.description = "check if getline_wrapped() does the right thing",
static DEFINE_TEST(test_freadline_wrapped,
.description = "check if freadline_wrapped() does the right thing",
.config = {
[TC_ROOTFS] = TESTSUITE_ROOTFS "test-util/",
},
.need_spawn = true,
.output = {
.out = TESTSUITE_ROOTFS "test-util/getline_wrapped-correct.txt",
.out = TESTSUITE_ROOTFS "test-util/freadline_wrapped-correct.txt",
});
static const struct test *tests[] = {
&salias_1,
&stest_getline_wrapped,
&stest_freadline_wrapped,
NULL,
};

View File

@ -686,7 +686,7 @@ static int cfg_file_parse(struct cfg *cfg, const char *filename)
return err;
}
while ((line = getline_wrapped(fp, &linenum)) != NULL) {
while ((line = freadline_wrapped(fp, &linenum)) != NULL) {
char *cmd, *saveptr;
if (line[0] == '\0' || line[0] == '#')