From: Namhyung Kim <namhyung@kernel.org>
To: Bernhard Rosenkraenzer <bernhard.rosenkranzer@linaro.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCHv2 1/1] perf: Port to Android
Date: Fri, 24 Aug 2012 18:09:49 +0900 [thread overview]
Message-ID: <877gsohd0i.fsf@sejong.aot.lge.com> (raw)
In-Reply-To: <87boi0hdcv.fsf@sejong.aot.lge.com> (Namhyung Kim's message of "Fri, 24 Aug 2012 18:02:24 +0900")
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
prev parent reply other threads:[~2012-08-24 9:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-23 15:01 [PATCHv2 1/1] perf: Port to Android Bernhard Rosenkraenzer
2012-08-23 20:51 ` Pekka Enberg
2012-08-23 21:32 ` David Ahern
2012-08-24 4:08 ` Matthew Garrett
2012-08-24 8:35 ` Ingo Molnar
2012-08-24 12:30 ` Alan Cox
2012-08-24 18:02 ` Ingo Molnar
2012-08-24 9:02 ` Namhyung Kim
2012-08-24 9:09 ` Namhyung Kim [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877gsohd0i.fsf@sejong.aot.lge.com \
--to=namhyung@kernel.org \
--cc=bernhard.rosenkranzer@linaro.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.