On Fri, 24 Aug 2012 18:02:24 +0900, Namhyung Kim wrote:
> On Thu, 23 Aug 2012 17:01:52 +0200, Bernhard Rosenkraenzer wrote:
[SNIP]
>> +
>> +/* Assorted functions that are missing from Bionic */
>> +static void psignal(int sig, const char *s)
>> +{
>> +    if(sig >= 0 && sig < NSIG) {
>> +            if(s)
>> +                    fprintf(stderr, "%s: %s\n", s, sys_siglist[sig]);
>> +            else
>> +                    fprintf(stderr, "%s\n", sys_siglist[sig]);
>> +    } else {
>> +            if(s)
>> +                    fprintf(stderr, "%s: invalid signal\n", s);
>> +            else
>> +                    fputs("invalid signal\n", stderr);
>> +    }
>> +}
>> +
>> +static ssize_t getline(char **lineptr, size_t *n, FILE *stream)
>> +{
>> +    size_t ret = 0;
>> +
>> +    if (!lineptr || !n || !stream)
>> +            return -1;
>> +
>> +    if(!*lineptr) {
>> +            *n = 128;
>> +            *lineptr = (char*)malloc(*n);
>> +            if(!*lineptr)
>> +                    return -1;
>> +    }
>> +
>> +    while(!feof(stream) && !ferror(stream)) {
>> +            int c;
>> +            if(ret == *n) {
>> +                    *n += 128;
>> +                    *lineptr = (char*)realloc(*lineptr, *n);
>> +                    if(!*lineptr) {
>> +                            *n = 0;
>> +                            return -1;
>> +                    }
>> +            }
>> +            c = fgetc(stream);
>> +            if(c == EOF)
>> +                    break;
>> +            *lineptr[ret++] = c;
>> +            if(c == '\n')
>> +                    break;
>> +    }
>> +    *lineptr[ret] = 0;
>> +    return ret;
>> +}
>
> And above two functions can be moved too somehow.

I meant it can be moved to the .c file.

Thanks,
Namhyung
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to