aboutsummaryrefslogtreecommitdiffstats
path: root/libfonts_parse_double__.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2023-01-09 21:36:56 +0100
committerMattias Andrée <maandree@kth.se>2023-01-09 21:36:56 +0100
commit0a42c64cddca69cf2c572d669c5639645d98437f (patch)
tree95f2c9da512b7bb960f863ac8319360fb4e06409 /libfonts_parse_double__.c
parentPrint warnings (diff)
downloadlibfonts-0a42c64cddca69cf2c572d669c5639645d98437f.tar.gz
libfonts-0a42c64cddca69cf2c572d669c5639645d98437f.tar.bz2
libfonts-0a42c64cddca69cf2c572d669c5639645d98437f.tar.xz
Implement libfonts_parse_double__ and last part of libfonts_get_output_rendering_settings (section aliases)
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'libfonts_parse_double__.c')
-rw-r--r--libfonts_parse_double__.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/libfonts_parse_double__.c b/libfonts_parse_double__.c
index 2fb182c..9aba573 100644
--- a/libfonts_parse_double__.c
+++ b/libfonts_parse_double__.c
@@ -6,9 +6,16 @@
int
libfonts_parse_double__(double *outp, const char *value)
{
- (void) outp;
- (void) value;
- return 0; /* TODO implement */
+ char *end;
+ int saved_errno = errno;
+ errno = 0;
+ *outp = strtod(value, &end);
+ if (errno || *end || isblank(*value)) {
+ errno = saved_errno;
+ return 0;
+ }
+ errno = saved_errno;
+ return 1;
}