libidav/utils.c

changeset 124
41939c8f3f9c
parent 119
451607eeff05
child 147
458a8dc68048
equal deleted inserted replaced
123:806c4dccf2ae 124:41939c8f3f9c
28 28
29 #include <time.h> 29 #include <time.h>
30 #include <stdio.h> 30 #include <stdio.h>
31 #include <stdlib.h> 31 #include <stdlib.h>
32 #include <string.h> 32 #include <string.h>
33 #include <errno.h>
33 #include <ucx/string.h> 34 #include <ucx/string.h>
34 #include <ucx/buffer.h> 35 #include <ucx/buffer.h>
35 #include <ucx/utils.h> 36 #include <ucx/utils.h>
36 #include <libxml/tree.h> 37 #include <libxml/tree.h>
37 #include <curl/curl.h> 38 #include <curl/curl.h>
73 return 0; 74 return 0;
74 } 75 }
75 76
76 int util_strtoint(char *str, int64_t *value) { 77 int util_strtoint(char *str, int64_t *value) {
77 char *end; 78 char *end;
79 errno = 0;
78 int64_t val = strtoll(str, &end, 0); 80 int64_t val = strtoll(str, &end, 0);
79 if(strlen(end) == 0) { 81 if(errno == 0) {
80 *value = val; 82 *value = val;
81 return 1; 83 return 1;
82 } else { 84 } else {
83 return 0; 85 return 0;
84 } 86 }

mercurial