SConscript('egl/main/SConscript')
if 'mesa' in env['statetrackers']:
+ if platform == 'windows':
+ SConscript('talloc/SConscript')
+
SConscript('glsl/SConscript')
SConscript('mapi/glapi/SConscript')
SConscript('mesa/SConscript')
--- /dev/null
+Import('*')
+
+if env['platform'] != 'windows':
+ Return()
+
+env = env.Clone()
+
+talloc = env.SharedLibrary(
+ target = 'talloc',
+ source = ['talloc.c', 'talloc.def'],
+)
+
+env.InstallSharedLibrary(talloc)
+
+if env['platform'] != 'windows':
+ talloc = env.FindIxes(talloc, 'LIBPREFIX', 'LIBSUFFIX')
+else:
+ talloc = env.FindIxes(talloc, 'SHLIBPREFIX', 'SHLIBSUFFIX')
+
+Export('talloc')
inspired by http://swapped.cc/halloc/
*/
-#include "replace.h"
#include "talloc.h"
+#include <string.h>
+
+#define TALLOC_MIN(a,b) ((a)<(b)?(a):(b))
+
+/* Visual C++ 2008 compatibility */
+#if defined(_MSC_VER) && !defined(_cplusplus)
+typedef size_t ssize_t;
+#define inline __inline
+#endif
+
+/* Xcode/gcc4.0 compatibility */
+#if defined(__APPLE__) || defined(__MINGW32__)
+static size_t strnlen (const char* s, size_t n)
+{
+ size_t i;
+ for (i = 0; i < n; ++i)
+ {
+ if (s[i] == '\0')
+ break;
+ }
+ return i;
+}
+#endif
+
+/* Visual C++ 2008 & Xcode/gcc4.0 compatibility */
+#if !defined(_cplusplus) && (defined(WIN32) || defined(__APPLE__))
+typedef int bool;
+#define false 0
+#define true 1
+#endif
+
#ifdef TALLOC_BUILD_VERSION_MAJOR
#if (TALLOC_VERSION_MAJOR != TALLOC_BUILD_VERSION_MAJOR)
}
if (new_ptr) {
- memcpy(new_ptr, tc, MIN(tc->size,size) + TC_HDR_SIZE);
+ memcpy(new_ptr, tc, TALLOC_MIN(tc->size,size) + TC_HDR_SIZE);
}
}
else {
return __talloc_strlendup_append(s, slen, a, strnlen(a, n));
}
-#ifndef HAVE_VA_COPY
+#ifndef va_copy
#ifdef HAVE___VA_COPY
#define va_copy(dest, src) __va_copy(dest, src)
#else
/* this call looks strange, but it makes it work on older solaris boxes */
va_copy(ap2, ap);
+ #ifdef _MSC_VER
+ /* MSVC runtime needs to use _vcsprintf to return buffer size; vsnprintf would return -1 */
+ len = _vscprintf(fmt, ap2);
+ #else
len = vsnprintf(&c, 1, fmt, ap2);
+ #endif
va_end(ap2);
if (unlikely(len < 0)) {
return NULL;
char c;
va_copy(ap2, ap);
+ #ifdef _MSC_VER
+ /* MSVC runtime needs to use _vcsprintf to return buffer size; vsnprintf would return -1 */
+ alen = _vscprintf(fmt, ap2);
+ #else
alen = vsnprintf(&c, 1, fmt, ap2);
+ #endif
va_end(ap2);
if (alen <= 0) {
--- /dev/null
+EXPORTS
+ _talloc
+ _talloc_array
+ _talloc_free
+ _talloc_get_type_abort
+ _talloc_memdup
+ _talloc_move
+ _talloc_realloc
+ _talloc_realloc_array
+ _talloc_reference_loc
+ _talloc_set_destructor
+ _talloc_steal_loc
+ _talloc_zero
+ _talloc_zero_array
+ talloc_asprintf
+ talloc_asprintf_append
+ talloc_asprintf_append_buffer
+ talloc_autofree_context
+ talloc_check_name
+ talloc_disable_null_tracking
+ talloc_enable_leak_report
+ talloc_enable_leak_report_full
+ talloc_enable_null_tracking
+ talloc_enable_null_tracking_no_autofree
+ talloc_find_parent_byname
+ talloc_free_children
+ talloc_get_name
+ talloc_get_size
+ talloc_increase_ref_count
+ talloc_init
+ talloc_is_parent
+ talloc_named
+ talloc_named_const
+ talloc_parent
+ talloc_parent_name
+ talloc_pool
+ talloc_realloc_fn
+ talloc_reference_count
+ talloc_reparent
+ talloc_report
+ talloc_report_depth_cb
+ talloc_report_depth_file
+ talloc_report_full
+ talloc_set_abort_fn
+ talloc_set_log_fn
+ talloc_set_log_stderr
+ talloc_set_name
+ talloc_set_name_const
+ talloc_show_parents
+ talloc_strdup
+ talloc_strdup_append
+ talloc_strdup_append_buffer
+ talloc_strndup
+ talloc_strndup_append
+ talloc_strndup_append_buffer
+ talloc_total_blocks
+ talloc_total_size
+ talloc_unlink
+ talloc_vasprintf
+ talloc_vasprintf_append
+ talloc_vasprintf_append_buffer
+ talloc_version_major
+ talloc_version_minor