Skip to content

Commit 3cfea58

Browse files
authored
use size_t to store allocated size (#263)
1 parent baa0924 commit 3cfea58

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

c_src/sqlite3_nif.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ exqlite_malloc(int bytes)
3737
{
3838
assert(bytes > 0);
3939

40-
int* p = enif_alloc(bytes + sizeof(int));
40+
size_t* p = enif_alloc(bytes + sizeof(size_t));
4141
if (p) {
4242
p[0] = bytes;
4343
p++;
@@ -53,7 +53,7 @@ exqlite_free(void* prior)
5353
return;
5454
}
5555

56-
int* p = prior;
56+
size_t* p = prior;
5757

5858
// Shift the pointer back to free the proper block of data
5959
p--;
@@ -67,10 +67,10 @@ exqlite_realloc(void* prior, int bytes)
6767
assert(prior);
6868
assert(bytes > 0);
6969

70-
int* p = prior;
70+
size_t* p = prior;
7171
p--;
7272

73-
p = enif_realloc(p, bytes + sizeof(int));
73+
p = enif_realloc(p, bytes + sizeof(size_t));
7474
if (p) {
7575
p[0] = bytes;
7676
p++;
@@ -86,7 +86,7 @@ exqlite_mem_size(void* prior)
8686
return 0;
8787
}
8888

89-
int* p = prior;
89+
size_t* p = prior;
9090
p--;
9191

9292
return p[0];

0 commit comments

Comments
 (0)