Skip to content
Snippets Groups Projects
Commit 78398522 authored by Lyndon Brown's avatar Lyndon Brown
Browse files

test

temporary test of whether platforms return null or non-null pointer for a
`malloc(0)` call.
parent 51bb2b4c
No related branches found
No related tags found
1 merge request!5test
Pipeline #124597 failed with stage
in 35 minutes and 7 seconds
......@@ -45,6 +45,19 @@ vlc_CPPFLAGS += -DHAVE_BREAKPAD
endif
endif
vlc_malloc0_SOURCES = malloc0.c
vlc_malloc0_CFLAGS = $(AM_CFLAGS) \
-DTOP_BUILDDIR=\"$$(cd "$(top_builddir)"; pwd)\" \
-DTOP_SRCDIR=\"$$(cd "$(top_srcdir)"; pwd)\" \
$(NULL)
vlc_malloc0_CPPFLAGS = $(vlc_CPPFLAGS)
vlc_malloc0_DEPENDENCIES = $(vlc_DEPENDENCIES)
vlc_malloc0_LDADD = $(vlc_LDADD)
vlc_malloc0_LDFLAGS = $(vlc_LDFLAGS) -no-install -static
if BUILD_VLC
bin_PROGRAMS += vlc-malloc0
endif
vlc_osx_SOURCES = darwinvlc.m
vlc_osx_LDFLAGS = $(LDFLAGS_vlc) -Wl,-framework,CoreFoundation,-framework,Cocoa
vlc_osx_LDFLAGS += -Xlinker -rpath -Xlinker "$(libdir)"
......@@ -146,3 +159,12 @@ endif
else \
echo "Cross-compilation: cache generation skipped!" ; \
fi
ls -la
echo "Trying to run malloc(0) test - BEFORE";
if !HAVE_WIN32
./vlc-malloc0 2>&1 malloc0.log
else
./vlc-malloc0.exe 2>&1 malloc0.log
endif
cat malloc0.log
echo "Trying to run malloc(0) test - AFTER";
#include <stdlib.h>
#include <stdio.h>
int main() {
void *ptr = malloc(0);
if (ptr == NULL) {
fprintf(stderr, "Pointer for malloc(0): null\n");
}
else {
fprintf(stderr, "Pointer for malloc(0): non-null (%p)\n", ptr);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment