mirror of
https://github.com/OpenRC/openrc.git
synced 2024-11-23 01:43:37 +08:00
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.
This commit is contained in:
parent
64c3b3e757
commit
cadc1d2840
@ -58,13 +58,3 @@ Who:
|
||||
If you have a c program that links to librc and uses functions from
|
||||
there, this section will list API functions which are deprecated and
|
||||
will be removed along with the reason they are being removed.
|
||||
|
||||
## rc_getline()
|
||||
|
||||
When: 1.0
|
||||
|
||||
Why: The getline() function was standardized in POSIX.1-2008, so it
|
||||
should be available on POSIX systems.
|
||||
|
||||
Who:
|
||||
|
||||
|
@ -102,30 +102,6 @@ rc_getfile(const char *file, char **buffer, size_t *len)
|
||||
return ret;
|
||||
}
|
||||
|
||||
ssize_t
|
||||
rc_getline(char **line, size_t *len, FILE *fp)
|
||||
{
|
||||
char *p;
|
||||
size_t last = 0;
|
||||
|
||||
while (!feof(fp)) {
|
||||
if (*line == NULL || last != 0) {
|
||||
*len += BUFSIZ;
|
||||
*line = xrealloc(*line, *len);
|
||||
}
|
||||
p = *line + last;
|
||||
memset(p, 0, BUFSIZ);
|
||||
if (fgets(p, BUFSIZ, fp) == NULL)
|
||||
break;
|
||||
last += strlen(p);
|
||||
if (last && (*line)[last - 1] == '\n') {
|
||||
(*line)[last - 1] = '\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
return last;
|
||||
}
|
||||
|
||||
char *
|
||||
rc_proc_getent(const char *ent RC_UNUSED)
|
||||
{
|
||||
|
@ -597,13 +597,9 @@ typedef LIST_HEAD(rc_pidlist, rc_pid) RC_PIDLIST;
|
||||
* @return NULL terminated list of pids */
|
||||
RC_PIDLIST *rc_find_pids(const char *, const char *const *, uid_t, pid_t);
|
||||
|
||||
/* Basically the same as rc_getline() below, it just returns multiple lines */
|
||||
/* Basically the same as getline(), it just returns multiple lines */
|
||||
bool rc_getfile(const char *, char **, size_t *);
|
||||
|
||||
/* getline is a handy glibc function that not all libcs have, so
|
||||
* we have our own */
|
||||
ssize_t rc_getline(char **, size_t *, FILE *);
|
||||
|
||||
/* __END_DECLS */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -15,7 +15,6 @@ global:
|
||||
rc_environ_fd;
|
||||
rc_find_pids;
|
||||
rc_getfile;
|
||||
rc_getline;
|
||||
rc_newer_than;
|
||||
rc_older_than;
|
||||
rc_proc_getent;
|
||||
|
Loading…
Reference in New Issue
Block a user