Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/external/bsd/sljit/dist/sljit_src Simplify previous, don...
details: https://anonhg.NetBSD.org/src/rev/2ad822202b9b
branches: trunk
changeset: 325576:2ad822202b9b
user: christos <christos%NetBSD.org@localhost>
date: Sun Dec 29 23:26:00 2013 +0000
description:
Simplify previous, don't even set the variables if they are not going to
be used.
diffstat:
sys/external/bsd/sljit/dist/sljit_src/sljitUtils.c | 30 +++++++++++----------
1 files changed, 16 insertions(+), 14 deletions(-)
diffs (52 lines):
diff -r c4497b8103ab -r 2ad822202b9b sys/external/bsd/sljit/dist/sljit_src/sljitUtils.c
--- a/sys/external/bsd/sljit/dist/sljit_src/sljitUtils.c Sun Dec 29 23:07:34 2013 +0000
+++ b/sys/external/bsd/sljit/dist/sljit_src/sljitUtils.c Sun Dec 29 23:26:00 2013 +0000
@@ -298,16 +298,13 @@
SLJIT_API_FUNC_ATTRIBUTE sljit_w SLJIT_CALL sljit_stack_resize(struct sljit_stack* stack, sljit_uw new_limit)
{
-#ifdef _WIN32
- sljit_uw aligned_old_limit;
- sljit_uw aligned_new_limit;
-#endif
-
if ((new_limit > stack->max_limit) || (new_limit < stack->base))
return -1;
#ifdef _WIN32
- aligned_new_limit = (new_limit + sljit_page_align) & ~sljit_page_align;
- aligned_old_limit = (stack->limit + sljit_page_align) & ~sljit_page_align;
+ sljit_uw aligned_new_limit =
+ (new_limit + sljit_page_align) & ~sljit_page_align;
+ sljit_uw aligned_old_limit =
+ (stack->limit + sljit_page_align) & ~sljit_page_align;
if (aligned_new_limit != aligned_old_limit) {
if (aligned_new_limit > aligned_old_limit) {
if (!VirtualAlloc((void*)aligned_old_limit, aligned_new_limit - aligned_old_limit, MEM_COMMIT, PAGE_READWRITE))
@@ -325,15 +322,20 @@
stack->limit = new_limit;
return 0;
}
- aligned_new_limit = (new_limit + sljit_page_align) & ~sljit_page_align;
- aligned_old_limit = (stack->limit + sljit_page_align) & ~sljit_page_align;
+#if defined(POSIX_MADV_DONTNEED)
+# define MADVISE(new, old) posix_madvise((new), (old), POSIX_MADV_DONTNEED)
+#elif defined(MADV_DONTNEED)
+# define MADVISE(new, old) madvise((new), (old), MADV_DONTNEED)
+#endif
+#ifdef MADVISE
+ sljit_uw aligned_new_limit =
+ (new_limit + sljit_page_align) & ~sljit_page_align;
+ sljit_uw aligned_old_limit =
+ (stack->limit + sljit_page_align) & ~sljit_page_align;
/* If madvise is available, we release the unnecessary space. */
-#if defined(POSIX_MADV_DONTNEED)
if (aligned_new_limit < aligned_old_limit)
- posix_madvise((void*)aligned_new_limit, aligned_old_limit - aligned_new_limit, POSIX_MADV_DONTNEED);
-#elif defined(MADV_DONTNEED)
- if (aligned_new_limit < aligned_old_limit)
- madvise((void*)aligned_new_limit, aligned_old_limit - aligned_new_limit, MADV_DONTNEED);
+ MADVISE((void*)aligned_new_limit,
+ aligned_old_limit - aligned_new_limit);
#endif
stack->limit = new_limit;
return 0;
Home |
Main Index |
Thread Index |
Old Index