psync_realloc removed
This commit is contained in:
parent
dea5073ae4
commit
9262fc0ee1
|
|
@ -312,7 +312,7 @@ static binresult *do_parse_result(unsigned char **restrict indata,
|
|||
while (**indata != RPARAM_END) {
|
||||
if (cnt == alloc) {
|
||||
alloc *= 2;
|
||||
arr = (binresult **)psync_realloc(arr, sizeof(binresult *) * alloc);
|
||||
arr = (binresult **)realloc(arr, sizeof(binresult *) * alloc);
|
||||
}
|
||||
arr[cnt++] = do_parse_result(indata, odata, strings, nextstrid);
|
||||
}
|
||||
|
|
@ -337,7 +337,7 @@ static binresult *do_parse_result(unsigned char **restrict indata,
|
|||
while (**indata != RPARAM_END) {
|
||||
if (cnt == alloc) {
|
||||
alloc *= 2;
|
||||
arr = (struct _hashpair *)psync_realloc(arr, sizeof(struct _hashpair) *
|
||||
arr = (struct _hashpair *)realloc(arr, sizeof(struct _hashpair) *
|
||||
alloc);
|
||||
}
|
||||
key = do_parse_result(indata, odata, strings, nextstrid);
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ static int psync_deflate_finish_flush_add_buffer(psync_deflate_t *def,
|
|||
}
|
||||
used += current;
|
||||
alloced *= 2;
|
||||
buff = (unsigned char *)psync_realloc(buff, alloced);
|
||||
buff = (unsigned char *)realloc(buff, alloced);
|
||||
current = alloced - used;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2711,7 +2711,7 @@ static void psync_diff_refresh_fs_add_folder(psync_folderid_t folderid) {
|
|||
refresh_allocated *= 2;
|
||||
else
|
||||
refresh_allocated = 8;
|
||||
refresh_folders = (psync_folderid_t *)psync_realloc(
|
||||
refresh_folders = (psync_folderid_t *)realloc(
|
||||
refresh_folders, sizeof(psync_folderid_t) * refresh_allocated);
|
||||
}
|
||||
refresh_folders[refresh_last++] = folderid;
|
||||
|
|
|
|||
|
|
@ -556,12 +556,12 @@ static folder_list *folder_list_init() {
|
|||
static void folder_list_add(folder_list *list, pentry_t *entry) {
|
||||
if (list->entriescnt >= list->entriesalloc) {
|
||||
list->entriesalloc *= 2;
|
||||
list->entries = (pentry_t *)psync_realloc(
|
||||
list->entries = (pentry_t *)realloc(
|
||||
list->entries, sizeof(pentry_t) * list->entriesalloc);
|
||||
}
|
||||
while (list->nameoff + entry->namelen >= list->namealloc) {
|
||||
list->namealloc *= 2;
|
||||
list->namebuff = (char *)psync_realloc(list->namebuff, list->namealloc);
|
||||
list->namebuff = (char *)realloc(list->namebuff, list->namealloc);
|
||||
}
|
||||
memcpy(&list->entries[list->entriescnt++], entry, sizeof(pentry_t));
|
||||
memcpy(list->namebuff + list->nameoff, entry->name, entry->namelen);
|
||||
|
|
@ -835,7 +835,7 @@ psync_folder_list_t *pfolder_sync_folders(char *syncTypes) {
|
|||
while ((row = psync_sql_fetch_row(res))) {
|
||||
if (alloced == lastfolder) {
|
||||
alloced = (alloced + 32) * 2;
|
||||
folders = (psync_tmp_folder_t *)psync_realloc(
|
||||
folders = (psync_tmp_folder_t *)realloc(
|
||||
folders, sizeof(psync_tmp_folder_t) * alloced);
|
||||
}
|
||||
cstr = psync_get_lstring(row[2], &l);
|
||||
|
|
|
|||
|
|
@ -1698,7 +1698,7 @@ psync_full_result_int *psync_sql_fetchall_int(psync_sql_res *res) {
|
|||
while ((code = sqlite3_step(res->stmt)) == SQLITE_ROW) {
|
||||
if (rows >= all) {
|
||||
all = 10 + all * 2;
|
||||
data = (uint64_t *)psync_realloc(data, sizeof(uint64_t) * cols * all);
|
||||
data = (uint64_t *)realloc(data, sizeof(uint64_t) * cols * all);
|
||||
}
|
||||
for (i = 0; i < cols; i++)
|
||||
data[off + i] = sqlite3_column_int64(res->stmt, i);
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ static void add_ignored_dir(const char *path) {
|
|||
ign_paths_alloc = 8;
|
||||
else
|
||||
ign_paths_alloc *= 2;
|
||||
ignored_paths = (device_inode_t *)psync_realloc(
|
||||
ignored_paths = (device_inode_t *)realloc(
|
||||
ignored_paths, sizeof(device_inode_t) * ign_paths_alloc);
|
||||
}
|
||||
ignored_paths[ign_paths_cnt].deviceid = pfile_stat_device_full(&st);
|
||||
|
|
|
|||
|
|
@ -165,15 +165,6 @@ PSYNC_NOINLINE void *psync_emergency_realloc(void *ptr, size_t size) {
|
|||
}
|
||||
}
|
||||
|
||||
void *psync_realloc(void *ptr, size_t size) {
|
||||
void *ret;
|
||||
ret = psync_real_realloc(ptr, size);
|
||||
if (likely(ret))
|
||||
return ret;
|
||||
else
|
||||
return psync_emergency_realloc(ptr, size);
|
||||
}
|
||||
|
||||
uint32_t psync_get_last_error() { return psync_error; }
|
||||
|
||||
void psync_set_database_path(const char *databasepath) {
|
||||
|
|
@ -1993,7 +1984,7 @@ psync_folderid_t *psync_crypto_folderids() {
|
|||
ret[l] = row[0];
|
||||
if (++l == alloc) {
|
||||
alloc *= 2;
|
||||
ret = (psync_folderid_t *)psync_realloc(ret,
|
||||
ret = (psync_folderid_t *)realloc(ret,
|
||||
sizeof(psync_folderid_t) * alloc);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -514,8 +514,6 @@ typedef void (*psync_free_t)(void *);
|
|||
|
||||
typedef void (*psync_generic_callback_t)();
|
||||
|
||||
void *psync_realloc(void *ptr, size_t size);
|
||||
|
||||
/* Event callback is called every time a download/upload is started/finished,
|
||||
* quota is changed, folder is shared or similar. Look at the PEVENT_ constants
|
||||
* for a list of possible events.
|
||||
|
|
|
|||
Loading…
Reference in New Issue