Add pack_ptr_list() helper function.
[smatch.git] / compat-cygwin.c
blob972d7c9691d3fe17cd2fb27ffbc6783697009178
1 /*
2 * Cygwin Compatibility functions
3 *
4 *
5 * Licensed under the Open Software License version 1.1
6 */
10 #include <sys/mman.h>
11 #include <stdlib.h>
12 #include <string.h>
13 #include <sys/stat.h>
15 #include "lib.h"
16 #include "token.h"
18 void *blob_alloc(unsigned long size)
20 void *ptr;
21 size = (size + 4095) & ~4095;
22 ptr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
23 if (ptr == MAP_FAILED)
24 ptr = NULL;
25 else
26 memset(ptr, 0, size);
27 return ptr;
30 void blob_free(void *addr, unsigned long size)
32 size = (size + 4095) & ~4095;
33 munmap(addr, size);
36 long double string_to_ld(const char *nptr, char **endptr)
38 return strtod(nptr, endptr);
41 int identical_files(struct stream* s, struct stat *st, const char * name)
43 return (s->dev == st->st_dev && s->ino == st->st_ino);