Upgrading to GitLab 11.10.0. Expect errors and see debian-infrastructure-announce@lists.debian.org for further information.

Imported Upstream version 1.6

parent b9cadbaa
jdupes 1.6
- Add the -l/--linksoft option to create symbolic links from duplicates
- Disable following symlinks to directories when -s/--symlinks is used
- Reduce overall memory usage by approximately 5%
- Add configurable path buffer sizes and path buffer overflow checks
- Fixes for some build warnings seen on ARM and MIPS
jdupes 1.5.1
- Significant reduction in memory usage (with a bonus tiny speed boost)
......
......@@ -47,7 +47,8 @@ MKDIR = mkdir -p
# Make Configuration
CC ?= gcc
COMPILER_OPTIONS = -Wall -Wextra -Wwrite-strings -Wcast-align -Wstrict-aliasing -pedantic -Wstrict-overflow
COMPILER_OPTIONS = -Wall -Wextra -Wwrite-strings -Wcast-align -Wstrict-aliasing -pedantic -Wstrict-overflow -Wstrict-prototypes -Wpointer-arith -Wundef
COMPILER_OPTIONS += -Wshadow -Wfloat-equal -Wstrict-overflow=5 -Waggregate-return -Wcast-qual -Wswitch-default -Wswitch-enum -Wconversion -Wunreachable-code -Wformat=2 -Winit-self
COMPILER_OPTIONS += -std=gnu99 -O2 -g -D_FILE_OFFSET_BITS=64 -fstrict-aliasing -pipe
#####################################################################
......@@ -65,7 +66,11 @@ endif
# MinGW needs this for printf() conversions to work
ifeq ($(OS), Windows_NT)
COMPILER_OPTIONS += -D__USE_MINGW_ANSI_STDIO=1 -municode
ifndef NO_UNICODE
UNICODE=1
COMPILER_OPTIONS += -municode
endif
COMPILER_OPTIONS += -D__USE_MINGW_ANSI_STDIO=1
OBJECT_FILES += win_stat.o
override undefine ENABLE_BTRFS
override undefine HAVE_BTRFS_IOCTL_H
......
This diff is collapsed.
This diff is collapsed.
......@@ -52,7 +52,7 @@ uintmax_t sma_free_tails = 0;
/* Scan the freed chunk list for a suitably sized object */
static inline void *scan_freelist(const size_t size)
{
char *min_p, *object;
size_t *min_p, *object;
size_t sz, min = 0;
int i, used = 0;
......@@ -68,7 +68,7 @@ static inline void *scan_freelist(const size_t size)
/* Skip empty entries */
if (object == NULL) continue;
sz = *(size_t *)object;
sz = *object;
used++;
/* Skip smaller objects */
......@@ -88,8 +88,8 @@ static inline void *scan_freelist(const size_t size)
if (min != 0) {
sma_freelist[i] = NULL;
sma_freelist_cnt--;
min_p += sizeof(size_t);
return min_p;
min_p++;
return (void *)min_p;
}
/* Fall through - free list search failed */
return NULL;
......@@ -105,8 +105,6 @@ static inline void *string_malloc_page(void)
pageptr = (uintptr_t *)malloc(SMA_PAGE_SIZE);
if (pageptr == NULL) return NULL;
*pageptr = (uintptr_t)NULL;
/* Link this page to the previous page */
*(pageptr + sizeof(uintptr_t)) = (uintptr_t)sma_lastpage;
/* Link previous page to this page, if applicable */
if (sma_lastpage != NULL) *sma_lastpage = (uintptr_t)pageptr;
......@@ -115,14 +113,14 @@ static inline void *string_malloc_page(void)
sma_lastpage = pageptr;
sma_pages++;
return (char *)pageptr;
return (void *)pageptr;
}
void *string_malloc(size_t len)
{
const char * restrict page = (char *)sma_lastpage;
static char *address;
const void * restrict page = (char *)sma_lastpage;
static size_t *address;
/* Calling with no actual length is invalid */
if (len < 1) return NULL;
......@@ -138,11 +136,11 @@ void *string_malloc(size_t len)
/* Pass-through allocations larger than maximum object size to malloc() */
if (len > (SMA_PAGE_SIZE - sizeof(uintptr_t) - sizeof(size_t))) {
/* Allocate the space */
address = (char *)malloc(len + sizeof(size_t));
address = (size_t *)malloc(len + sizeof(size_t));
if (!address) return NULL;
/* Prefix object with its size */
*(size_t *)address = (size_t)len;
address += sizeof(size_t);
*address = len;
address++;
DBG(sma_allocs++;)
return (void *)address;
}
......@@ -154,42 +152,42 @@ void *string_malloc(size_t len)
/* Allocate first page and set up for first allocation */
sma_head = string_malloc_page();
if (!sma_head) return NULL;
sma_nextfree = (2 * sizeof(uintptr_t));
sma_nextfree = sizeof(uintptr_t);
page = sma_head;
}
/* Allocate objects from the free list first */
address = (char *)scan_freelist(len);
address = (size_t *)scan_freelist(len);
if (address != NULL) {
DBG(sma_free_reclaimed++;)
return address;
return (void *)address;
}
/* Allocate new page if this object won't fit */
if ((sma_nextfree + len) > SMA_PAGE_SIZE) {
size_t sz;
char *tailaddr;
size_t *tailaddr;
/* See if remaining space is usable */
if (sma_freelist_cnt < SMA_MAX_FREE && sma_nextfree < SMA_PAGE_SIZE) {
/* Get total remaining space size */
sz = SMA_PAGE_SIZE - sma_nextfree;
if (sz >= (SMA_MIN_SLACK + sizeof(size_t))) {
tailaddr = (char *)page + sma_nextfree;
*(size_t *)tailaddr = (size_t)sz;
string_free(tailaddr + sizeof(size_t));
tailaddr = (size_t *)((uintptr_t)page + sma_nextfree);
*tailaddr = sz;
string_free(tailaddr + 1);
DBG(sma_free_tails++;)
}
}
page = string_malloc_page();
if (!page) return NULL;
sma_nextfree = (2 * sizeof(uintptr_t));
sma_nextfree = sizeof(uintptr_t);
}
/* Allocate the space */
address = (char *)page + sma_nextfree;
address = (size_t *)((uintptr_t)page + sma_nextfree);
/* Prefix object with its size */
*(size_t *)address = (size_t)len;
address += sizeof(size_t);
*address = len;
address++;
sma_nextfree += len;
DBG(sma_allocs++;)
......@@ -201,19 +199,20 @@ void *string_malloc(size_t len)
void string_free(void * const restrict addr)
{
int i = 0;
size_t * const restrict a = (size_t *)addr - 1;
/* Do nothing on NULL address or full free list */
if ((addr == NULL) || sma_freelist_cnt == SMA_MAX_FREE)
goto sf_failed;
/* Tiny objects keep big ones from being freed; ignore them */
if (*(size_t *)((char *)addr - sizeof(size_t)) < (SMA_MIN_SLACK + sizeof(size_t)))
if (*(size_t *)((uintptr_t)addr - sizeof(size_t)) < (SMA_MIN_SLACK + sizeof(size_t)))
goto sf_failed;
/* Add object to free list */
while (i < SMA_MAX_FREE) {
if (sma_freelist[i] == NULL) {
sma_freelist[i] = (char *)addr - sizeof(size_t);
sma_freelist[i] = a;
sma_freelist_cnt++;
DBG(sma_free_good++;)
return;
......
regular_file
\ No newline at end of file
......@@ -3,7 +3,7 @@
#ifndef JDUPES_VERSION_H
#define JDUPES_VERSION_H
#define VER "1.5.1"
#define VERDATE "2016-11-01"
#define VER "1.6"
#define VERDATE "2016-11-27"
#endif /* JDUPES_VERSION_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment