Skip to content

Commit cadc1d2

Browse files
navi-desuwilliamh
authored andcommitted
librc: Remove rc_getline.
getline(3) got standardized in posix 2008 and is common place on all libc implementations now a days, and rc_getline is tagged for removal for ages now.
1 parent 64c3b3e commit cadc1d2

4 files changed

Lines changed: 1 addition & 40 deletions

File tree

FEATURE-REMOVAL-SCHEDULE.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,3 @@ Who:
5858
If you have a c program that links to librc and uses functions from
5959
there, this section will list API functions which are deprecated and
6060
will be removed along with the reason they are being removed.
61-
62-
## rc_getline()
63-
64-
When: 1.0
65-
66-
Why: The getline() function was standardized in POSIX.1-2008, so it
67-
should be available on POSIX systems.
68-
69-
Who:
70-

src/librc/librc-misc.c

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -102,30 +102,6 @@ rc_getfile(const char *file, char **buffer, size_t *len)
102102
return ret;
103103
}
104104

105-
ssize_t
106-
rc_getline(char **line, size_t *len, FILE *fp)
107-
{
108-
char *p;
109-
size_t last = 0;
110-
111-
while (!feof(fp)) {
112-
if (*line == NULL || last != 0) {
113-
*len += BUFSIZ;
114-
*line = xrealloc(*line, *len);
115-
}
116-
p = *line + last;
117-
memset(p, 0, BUFSIZ);
118-
if (fgets(p, BUFSIZ, fp) == NULL)
119-
break;
120-
last += strlen(p);
121-
if (last && (*line)[last - 1] == '\n') {
122-
(*line)[last - 1] = '\0';
123-
break;
124-
}
125-
}
126-
return last;
127-
}
128-
129105
char *
130106
rc_proc_getent(const char *ent RC_UNUSED)
131107
{

src/librc/rc.h.in

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -597,13 +597,9 @@ typedef LIST_HEAD(rc_pidlist, rc_pid) RC_PIDLIST;
597597
* @return NULL terminated list of pids */
598598
RC_PIDLIST *rc_find_pids(const char *, const char *const *, uid_t, pid_t);
599599

600-
/* Basically the same as rc_getline() below, it just returns multiple lines */
600+
/* Basically the same as getline(), it just returns multiple lines */
601601
bool rc_getfile(const char *, char **, size_t *);
602602

603-
/* getline is a handy glibc function that not all libcs have, so
604-
* we have our own */
605-
ssize_t rc_getline(char **, size_t *, FILE *);
606-
607603
/* __END_DECLS */
608604
#ifdef __cplusplus
609605
}

src/librc/rc.map

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ global:
1515
rc_environ_fd;
1616
rc_find_pids;
1717
rc_getfile;
18-
rc_getline;
1918
rc_newer_than;
2019
rc_older_than;
2120
rc_proc_getent;

0 commit comments

Comments
 (0)