[vala/staging] glib-2.0: Reset errno before calling strto*() functions.
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] glib-2.0: Reset errno before calling strto*() functions.
- Date: Mon, 6 Jan 2020 09:00:34 +0000 (UTC)
commit af236c9595e80803ff0e9b38b352e6a5153f4985
Author: Jeremy Philippe <jeremy philippe gmail com>
Date: Sat Jan 4 00:41:37 2020 +0100
glib-2.0: Reset errno before calling strto*() functions.
Standard library functions only set errno on error and these particular
functions return an "in-band" error indicator (the error indicator is
also a normal return value).
vapi/glib-2.0.vapi | 8 ++++++++
1 file changed, 8 insertions(+)
---
diff --git a/vapi/glib-2.0.vapi b/vapi/glib-2.0.vapi
index 6a2109f3e..e4ce4dcd6 100644
--- a/vapi/glib-2.0.vapi
+++ b/vapi/glib-2.0.vapi
@@ -155,6 +155,7 @@ public struct int {
public static bool try_parse (string str, out int result = null, out unowned string unparsed = null,
uint _base = 0) {
char* endptr;
+ errno = 0;
long long_result = strtol (str, out endptr, (int) _base);
if (endptr == (char*) str + str.length) {
unparsed = "";
@@ -215,6 +216,7 @@ public struct uint {
public static bool try_parse (string str, out uint result = null, out unowned string unparsed = null,
uint _base = 0) {
char* endptr;
+ errno = 0;
ulong ulong_result = strtoul (str, out endptr, (int) _base);
if (endptr == (char*) str + str.length) {
unparsed = "";
@@ -316,6 +318,7 @@ public struct long {
public static bool try_parse (string str, out long result = null, out unowned string unparsed = null,
uint _base = 0) {
char* endptr;
+ errno = 0;
result = strtol (str, out endptr, (int) _base);
if (endptr == (char*) str + str.length) {
unparsed = "";
@@ -366,6 +369,7 @@ public struct ulong {
public static bool try_parse (string str, out ulong result = null, out unowned string unparsed =
null, uint _base = 0) {
char* endptr;
+ errno = 0;
result = strtoul (str, out endptr, (int) _base);
if (endptr == (char*) str + str.length) {
unparsed = "";
@@ -770,6 +774,7 @@ public struct int64 {
[Version (since = "2.12")]
public static bool try_parse (string str, out int64 result = null, out unowned string unparsed =
null, uint _base = 0) {
char* endptr;
+ errno = 0;
result = ascii_strtoll (str, out endptr, _base);
if (endptr == (char*) str + str.length) {
unparsed = "";
@@ -829,6 +834,7 @@ public struct uint64 {
public static bool try_parse (string str, out uint64 result = null, out unowned string unparsed =
null, uint _base = 0) {
char* endptr;
+ errno = 0;
result = ascii_strtoull (str, out endptr, _base);
if (endptr == (char*) str + str.length) {
unparsed = "";
@@ -910,6 +916,7 @@ public struct float {
public static bool try_parse (string str, out float result = null, out unowned string unparsed =
null) {
char* endptr;
+ errno = 0;
result = strtof (str, out endptr);
if (endptr == (char*) str + str.length) {
unparsed = "";
@@ -991,6 +998,7 @@ public struct double {
public static bool try_parse (string str, out double result = null, out unowned string unparsed =
null) {
char* endptr;
+ errno = 0;
result = ascii_strtod (str, out endptr);
if (endptr == (char*) str + str.length) {
unparsed = "";
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]