This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Importing inttypes methods


This is the modified patches for inttypes methods. I have changed the
method name with trailing _l . Do i need to send the patch for imaxabs
and imaxdiv method again ? I am attaching patch v2 for strtoimax,
strtoumax, wcstoimax and wcstoumax.
Please review the same.

Thanks & Regards,
Aditya Upadhyay

On Wed, Jul 26, 2017 at 5:32 PM, Aditya Upadhyay <aadit0402@gmail.com> wrote:
> On Wed, Jul 26, 2017 at 4:38 PM, Corinna Vinschen <vinschen@redhat.com> wrote:
>> On Jul 26 01:20, Aditya Upadhyay wrote:
>>> Hello All,
>>>
>>> I have ported the inttypes methods from freeBSD. I have made all the
>>> possible changes whatever my mentors suggested me. I am requesting you
>>> to please review the same. Is this ok for master ?
>>
>> The patches apply and build.  This looks 99% good now, thank you.
>>
> Thanks.
>> Just one last minor problem, which is my fault, not yours:
>>
>> You named the reentrant functions _strtoimax_r, _wcstoumax_r, etc.,
>> which is basically right.
>>
>> However, the *other*, equivalent reentrant, locale-specific functions
>> for other datatypes are all named with a trailing l: _strtol_l,
>> _wcstoull_l, etc.  In retrospect, this wasn't the brightest idea,
>> but the API has been exported this way, so I'm reluctant to change
>> it after the fact.
>>
>> Would you mind to call your new functions with trailing 'l' rather
>> than 'r', too, to use the same naming convention, please?
>>
> I will keep your points in mind whenever i will port a new function.
>> Oh, btw., please make sure the patches have no trailing whitespace.
>> That's not really a problem, but `git am' complains about them.
>>
>>
>> Thanks,
>> Corinna
>>
>> --
>> Corinna Vinschen
>> Cygwin Maintainer
>> Red Hat
From 5772bf5cc3ed2b5f0b98f568eff2c919841b9938 Mon Sep 17 00:00:00 2001
From: Aditya Upadhyay <aadit0402@gmail.com>
Date: Thu, 27 Jul 2017 02:30:23 +0530
Subject: [PATCH v2 1/4] importing strtoimax inttypes methods with fixed
 trailed l.

---
 newlib/libc/include/inttypes.h | 2 +-
 newlib/libc/stdlib/strtoimax.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/newlib/libc/include/inttypes.h b/newlib/libc/include/inttypes.h
index 2cba659fb..cabcefbec 100644
--- a/newlib/libc/include/inttypes.h
+++ b/newlib/libc/include/inttypes.h
@@ -323,7 +323,7 @@ extern "C" {
 extern intmax_t  imaxabs(intmax_t j);
 extern imaxdiv_t imaxdiv(intmax_t numer, intmax_t denomer);
 extern intmax_t  strtoimax_l(const char *__restrict, char **_restrict, int, locale_t);
-extern intmax_t  _strtoimax_r(struct _reent *, const char *__restrict, char **__restrict, int, locale_t);
+extern intmax_t  _strtoimax_l(struct _reent *, const char *__restrict, char **__restrict, int, locale_t);
 extern intmax_t  strtoimax(const char *__restrict, char **__restrict, int);
 extern uintmax_t strtoumax_l(const char *__restrict, char **_restrict, int, locale_t);
 extern uintmax_t _strtoumax_r(struct _reent *, const char *__restrict, char **__restrict, int, locale_t);
diff --git a/newlib/libc/stdlib/strtoimax.c b/newlib/libc/stdlib/strtoimax.c
index d041c300c..e7f0d329f 100644
--- a/newlib/libc/stdlib/strtoimax.c
+++ b/newlib/libc/stdlib/strtoimax.c
@@ -57,7 +57,7 @@ __FBSDID("$FreeBSD: head/lib/libc/stdlib/strtoimax.c 251672 2013-06-13 00:19:30Z
  *Reentrant version of strtoimax.
  */
 intmax_t
-_strtoimax_r(struct _reent *rptr, const char * __restrict nptr,
+_strtoimax_l(struct _reent *rptr, const char * __restrict nptr,
 	     char ** __restrict endptr, int base, locale_t loc)
 {
 	const char *s = (const unsigned char *)nptr;
@@ -147,10 +147,10 @@ intmax_t
 strtoimax_l(const char * __restrict nptr, char ** __restrict endptr, int base,
 	    locale_t loc)
 {
-	return _strtoimax_r(_REENT, nptr, endptr, base, loc);
+	return _strtoimax_l(_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());
+	return _strtoimax_l(_REENT, nptr, endptr, base, __get_current_locale());
 }		
-- 
2.13.0

From e0eda0ce0df697d51443d916f947b9a576753705 Mon Sep 17 00:00:00 2001
From: Aditya Upadhyay <aadit0402@gmail.com>
Date: Thu, 27 Jul 2017 02:33:38 +0530
Subject: [PATCH v2 2/4] importing strtoumax inttypes methods with fixed
 trailed l.

---
 newlib/libc/include/inttypes.h | 2 +-
 newlib/libc/stdlib/strtoumax.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/newlib/libc/include/inttypes.h b/newlib/libc/include/inttypes.h
index cabcefbec..6e94a5385 100644
--- a/newlib/libc/include/inttypes.h
+++ b/newlib/libc/include/inttypes.h
@@ -326,7 +326,7 @@ extern intmax_t  strtoimax_l(const char *__restrict, char **_restrict, int, loca
 extern intmax_t  _strtoimax_l(struct _reent *, const char *__restrict, char **__restrict, int, locale_t);
 extern intmax_t  strtoimax(const char *__restrict, char **__restrict, int);
 extern uintmax_t strtoumax_l(const char *__restrict, char **_restrict, int, locale_t);
-extern uintmax_t _strtoumax_r(struct _reent *, const char *__restrict, char **__restrict, int, locale_t);
+extern uintmax_t _strtoumax_l(struct _reent *, const char *__restrict, char **__restrict, int, locale_t);
 extern uintmax_t strtoumax(const char *__restrict, char **__restrict, int);
 extern intmax_t  wcstoimax_l(const wchar_t *__restrict, wchar_t **_restrict, int, locale_t);
 extern intmax_t  _wcstoimax_r(struct _reent *, const wchar_t *__restrict, wchar_t **__restrict, int, locale_t);
diff --git a/newlib/libc/stdlib/strtoumax.c b/newlib/libc/stdlib/strtoumax.c
index 240a6afed..b2426a580 100644
--- a/newlib/libc/stdlib/strtoumax.c
+++ b/newlib/libc/stdlib/strtoumax.c
@@ -57,7 +57,7 @@ __FBSDID("$FreeBSD: head/lib/libc/stdlib/strtoumax.c 251672 2013-06-13 00:19:30Z
  *Reentrant version of strtoumax.
  */
 uintmax_t
-_strtoumax_r(struct _reent *rptr, const char * __restrict nptr, 
+_strtoumax_l(struct _reent *rptr, const char * __restrict nptr, 
 	     char ** __restrict endptr, int base, locale_t loc)
 {
 	const char *s = (const unsigned char *)nptr;
@@ -129,10 +129,10 @@ uintmax_t
 strtoumax_l(const char * __restrict nptr, char ** __restrict endptr, int base,
 	    locale_t loc)
 {
-	return _strtoumax_r(_REENT, nptr, endptr, base, loc);
+	return _strtoumax_l(_REENT, nptr, endptr, base, loc);
 }
 uintmax_t
 strtoumax(const char* __restrict nptr, char** __restrict endptr, int base)
 {
-	return _strtoumax_r(_REENT, nptr, endptr, base, __get_current_locale());
+	return _strtoumax_l(_REENT, nptr, endptr, base, __get_current_locale());
 }
-- 
2.13.0

From 0b63ccd01d3fa913bd28a0478f8917071153995a Mon Sep 17 00:00:00 2001
From: Aditya Upadhyay <aadit0402@gmail.com>
Date: Thu, 27 Jul 2017 02:34:29 +0530
Subject: [PATCH v2 3/4] importing wcstoimax inttypes methods with fixed
 trailed l.

---
 newlib/libc/include/inttypes.h | 2 +-
 newlib/libc/stdlib/wcstoimax.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/newlib/libc/include/inttypes.h b/newlib/libc/include/inttypes.h
index 6e94a5385..5ca0bfcd2 100644
--- a/newlib/libc/include/inttypes.h
+++ b/newlib/libc/include/inttypes.h
@@ -329,7 +329,7 @@ extern uintmax_t strtoumax_l(const char *__restrict, char **_restrict, int, loca
 extern uintmax_t _strtoumax_l(struct _reent *, const char *__restrict, char **__restrict, int, locale_t);
 extern uintmax_t strtoumax(const char *__restrict, char **__restrict, int);
 extern intmax_t  wcstoimax_l(const wchar_t *__restrict, wchar_t **_restrict, int, locale_t);
-extern intmax_t  _wcstoimax_r(struct _reent *, const wchar_t *__restrict, wchar_t **__restrict, int, locale_t);
+extern intmax_t  _wcstoimax_l(struct _reent *, const wchar_t *__restrict, wchar_t **__restrict, int, locale_t);
 extern intmax_t  wcstoimax(const wchar_t *__restrict, wchar_t **__restrict, int);
 extern uintmax_t wcstoumax_l(const wchar_t *__restrict, wchar_t **_restrict, int, locale_t);
 extern uintmax_t _wcstoumax_r(struct _reent *, const wchar_t *__restrict, wchar_t **__restrict, int, locale_t);
diff --git a/newlib/libc/stdlib/wcstoimax.c b/newlib/libc/stdlib/wcstoimax.c
index 0994bcb94..dd350e6be 100644
--- a/newlib/libc/stdlib/wcstoimax.c
+++ b/newlib/libc/stdlib/wcstoimax.c
@@ -58,7 +58,7 @@ __FBSDID("$FreeBSD: head/lib/libc/locale/wcstoimax.c 314436 2017-02-28 23:42:47Z
  *Reentrant version of wcstoimax.
  */
 intmax_t
-_wcstoimax_r(struct _reent *rptr, const wchar_t * __restrict nptr, 
+_wcstoimax_l(struct _reent *rptr, const wchar_t * __restrict nptr, 
 	     wchar_t ** __restrict endptr, int base, locale_t loc)
 {
 	const wchar_t *s = nptr;
@@ -136,10 +136,10 @@ intmax_t
 wcstoimax_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
     	    int base, locale_t loc)
 {
-	return _wcstoimax_r(_REENT, nptr, endptr, base, loc);
+	return _wcstoimax_l(_REENT, nptr, endptr, base, loc);
 }
 intmax_t
 wcstoimax(const wchar_t* __restrict nptr, wchar_t** __restrict endptr, int base)
 {
-	return _wcstoimax_r(_REENT, nptr, endptr, base, __get_current_locale());
+	return _wcstoimax_l(_REENT, nptr, endptr, base, __get_current_locale());
 }
-- 
2.13.0

From cafa77e418bc3eca5ad417b481b586400e79790c Mon Sep 17 00:00:00 2001
From: Aditya Upadhyay <aadit0402@gmail.com>
Date: Thu, 27 Jul 2017 02:34:52 +0530
Subject: [PATCH v2 4/4] importing wcstoumax inttypes methods with fixed
 trailed l.

---
 newlib/libc/include/inttypes.h | 2 +-
 newlib/libc/stdlib/wcstoumax.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/newlib/libc/include/inttypes.h b/newlib/libc/include/inttypes.h
index 5ca0bfcd2..532976ad7 100644
--- a/newlib/libc/include/inttypes.h
+++ b/newlib/libc/include/inttypes.h
@@ -332,7 +332,7 @@ extern intmax_t  wcstoimax_l(const wchar_t *__restrict, wchar_t **_restrict, int
 extern intmax_t  _wcstoimax_l(struct _reent *, const wchar_t *__restrict, wchar_t **__restrict, int, locale_t);
 extern intmax_t  wcstoimax(const wchar_t *__restrict, wchar_t **__restrict, int);
 extern uintmax_t wcstoumax_l(const wchar_t *__restrict, wchar_t **_restrict, int, locale_t);
-extern uintmax_t _wcstoumax_r(struct _reent *, const wchar_t *__restrict, wchar_t **__restrict, int, locale_t);
+extern uintmax_t _wcstoumax_l(struct _reent *, const wchar_t *__restrict, wchar_t **__restrict, int, locale_t);
 extern uintmax_t wcstoumax(const wchar_t *__restrict, wchar_t **__restrict, int);
 
 #ifdef __cplusplus
diff --git a/newlib/libc/stdlib/wcstoumax.c b/newlib/libc/stdlib/wcstoumax.c
index da58532b9..dfa25bd0e 100644
--- a/newlib/libc/stdlib/wcstoumax.c
+++ b/newlib/libc/stdlib/wcstoumax.c
@@ -58,7 +58,7 @@ __FBSDID("$FreeBSD: head/lib/libc/locale/wcstoumax.c 314436 2017-02-28 23:42:47Z
  *Reentrant version of wcstoumax.
  */
 uintmax_t
-_wcstoumax_r(struct _reent *rptr,const wchar_t * __restrict nptr, 
+_wcstoumax_l(struct _reent *rptr,const wchar_t * __restrict nptr, 
 	     wchar_t ** __restrict endptr, int base, locale_t loc)
 {
 	const wchar_t *s = nptr;
@@ -135,10 +135,10 @@ uintmax_t
 wcstoumax_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
     	    int base, locale_t loc)
 {
-	return _wcstoumax_r(_REENT, nptr, endptr, base, loc);
+	return _wcstoumax_l(_REENT, nptr, endptr, base, loc);
 }
 uintmax_t
 wcstoumax(const wchar_t* __restrict nptr, wchar_t** __restrict endptr, int base)
 {
-	return _wcstoumax_r(_REENT, nptr, endptr, base, __get_current_locale());
+	return _wcstoumax_l(_REENT, nptr, endptr, base, __get_current_locale());
 }
-- 
2.13.0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]