1*1f5207b7SJohn Levon /*
2*1f5207b7SJohn Levon * MinGW Compatibility functions
3*1f5207b7SJohn Levon *
4*1f5207b7SJohn Levon *
5*1f5207b7SJohn Levon * Permission is hereby granted, free of charge, to any person obtaining a copy
6*1f5207b7SJohn Levon * of this software and associated documentation files (the "Software"), to deal
7*1f5207b7SJohn Levon * in the Software without restriction, including without limitation the rights
8*1f5207b7SJohn Levon * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9*1f5207b7SJohn Levon * copies of the Software, and to permit persons to whom the Software is
10*1f5207b7SJohn Levon * furnished to do so, subject to the following conditions:
11*1f5207b7SJohn Levon *
12*1f5207b7SJohn Levon * The above copyright notice and this permission notice shall be included in
13*1f5207b7SJohn Levon * all copies or substantial portions of the Software.
14*1f5207b7SJohn Levon *
15*1f5207b7SJohn Levon * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16*1f5207b7SJohn Levon * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17*1f5207b7SJohn Levon * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18*1f5207b7SJohn Levon * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19*1f5207b7SJohn Levon * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20*1f5207b7SJohn Levon * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21*1f5207b7SJohn Levon * THE SOFTWARE.
22*1f5207b7SJohn Levon */
23*1f5207b7SJohn Levon
24*1f5207b7SJohn Levon
25*1f5207b7SJohn Levon
26*1f5207b7SJohn Levon #include <stdarg.h>
27*1f5207b7SJohn Levon #include <windef.h>
28*1f5207b7SJohn Levon #include <winbase.h>
29*1f5207b7SJohn Levon #include <stdlib.h>
30*1f5207b7SJohn Levon #include <string.h>
31*1f5207b7SJohn Levon
32*1f5207b7SJohn Levon #include "lib.h"
33*1f5207b7SJohn Levon #include "allocate.h"
34*1f5207b7SJohn Levon #include "token.h"
35*1f5207b7SJohn Levon
blob_alloc(unsigned long size)36*1f5207b7SJohn Levon void *blob_alloc(unsigned long size)
37*1f5207b7SJohn Levon {
38*1f5207b7SJohn Levon void *ptr;
39*1f5207b7SJohn Levon ptr = malloc(size);
40*1f5207b7SJohn Levon if (ptr != NULL)
41*1f5207b7SJohn Levon memset(ptr, 0, size);
42*1f5207b7SJohn Levon return ptr;
43*1f5207b7SJohn Levon }
44*1f5207b7SJohn Levon
blob_free(void * addr,unsigned long size)45*1f5207b7SJohn Levon void blob_free(void *addr, unsigned long size)
46*1f5207b7SJohn Levon {
47*1f5207b7SJohn Levon free(addr);
48*1f5207b7SJohn Levon }
49*1f5207b7SJohn Levon
string_to_ld(const char * nptr,char ** endptr)50*1f5207b7SJohn Levon long double string_to_ld(const char *nptr, char **endptr)
51*1f5207b7SJohn Levon {
52*1f5207b7SJohn Levon return strtod(nptr, endptr);
53*1f5207b7SJohn Levon }
54