From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 129351 invoked by alias); 19 Jul 2017 13:23:24 -0000 Mailing-List: contact newlib-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: newlib-owner@sourceware.org Received: (qmail 129340 invoked by uid 89); 19 Jul 2017 13:23:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.8 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1924 X-HELO: mail-it0-f54.google.com Received: from mail-it0-f54.google.com (HELO mail-it0-f54.google.com) (209.85.214.54) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 19 Jul 2017 13:23:21 +0000 Received: by mail-it0-f54.google.com with SMTP id h199so384747ith.1 for ; Wed, 19 Jul 2017 06:23:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=ixEYnTcr+z9XGUUEUvqms5hIAmcX6QZ6EFAJSeQau7s=; b=DzfIB7876Urh3C4dXFYDGUoQsa3ivoQFvYjVVtA0NdF6J2Lq4gRhjV8eREPItMrPui gLmaCJZldu8T5765b3IuyX0skIIHDGEJxMvalBPvWRSsR6jtyK5cMfSPkXizq1zhOHCJ pGoeBtOhb47B1/+OGx94smDB6lFsHczFyg30F8twnbgogx2oQHtyp7dR7pZWh3Cxq4oM aZmCIijnJzWL/Hyd0JgTpNzvzzSuqGwpvyRbGOX1yaLDYM79BrOhC7pbZzSiCE31KJA/ QWdsaUPZ+9znZ4yOxFhYYkx+WKCI0RD99f0FWx/XKGKgJyjSCm8YHlkKRc7wEVPStfX7 zVWQ== X-Gm-Message-State: AIVw113xPocsRSum2gxQVhE65NR6TQdZijnd8CzqHkDpBPMe1Q2YLYft YLYbTKXaIS/k+8vwhfdG14jtEyZBP3MQ X-Received: by 10.36.46.19 with SMTP id i19mr62600ita.124.1500470599516; Wed, 19 Jul 2017 06:23:19 -0700 (PDT) MIME-Version: 1.0 Received: by 10.79.124.208 with HTTP; Wed, 19 Jul 2017 06:23:18 -0700 (PDT) In-Reply-To: <20170719122806.GA6325@calimero.vinschen.de> References: <20170719122806.GA6325@calimero.vinschen.de> From: Aditya Upadhyay Date: Wed, 19 Jul 2017 13:23:00 -0000 Message-ID: Subject: Re: Importing inttypes methods from FreeBSD To: newlib@sourceware.org Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2017/txt/msg00602.txt.bz2 Thanks Corinna for helping me to understand these stuff. I am making the changes with this snippet. Regards, Aditya On Wed, Jul 19, 2017 at 5:58 PM, Corinna Vinschen wrote: > Hi Aditya, > > On Jul 19 03:09, Aditya Upadhyay wrote: >> diff --git a/newlib/libc/stdlib/strtoimax.c b/newlib/libc/stdlib/strtoimax.c >> new file mode 100644 >> index 000000000..0cb6e2acc >> --- /dev/null >> +++ b/newlib/libc/stdlib/strtoimax.c >> @@ -0,0 +1,146 @@ >> [...] >> +intmax_t >> +strtoimax_l(struct _reent *rptr, const char * __restrict nptr, char ** __restrict endptr, int base, >> + locale_t loc) >> +{ > > This is not quite what you want. strtoimax_l in BSD does not require a > reent as first parameter. By changing the function this way, you > disallow to export the function in a BSD-compatible way. Also keep in > mind that it's always possible that the function name might become > standarized (POSIX) at one point, just like the original GNU > locale-specific functions got standarized. > > What you really want is to define a static function which takes the > reent pointer and strtoimax_l/strtoimax only calling that, like this: > > --- snip --- > static intmax_t > _strtoimax_r(struct _reent *rptr, const char * __restrict nptr, > char ** __restrict endptr, int base, locale_t loc) > { > [Add here all functionality you put into strtoimax_l] > } > > intmax_t > strtoimax_l(const char * __restrict nptr, char ** __restrict endptr, int base, > locale_t loc) > { > return _strtoimax_r (_REENT, nptr, endptr, base, loc); > } > > intmax_t > strtoimax(const char * __restrict nptr, char ** __restrict endptr, int base) > { > return _strtoimax_r (_REENT, nptr, endptr, base, __get_current_locale ()); > } > --- snap --- > > Also, please keep the line length < 80 chars if possible. > > > Thanks, > Corinna > > -- > Corinna Vinschen > Cygwin Maintainer > Red Hat