* Merged gc7-branch to default.
[cacao.git] / src / vm / assertion.c
index 0140b0ac9e4c3d1778352f954a1553ab914f158b..6a1f0f694f13a8132d7b82ab7010f03db88e423a 100644 (file)
@@ -1,7 +1,7 @@
 /* src/vm/assertion.c - assertion options
 
-   Copyright (C) 2007
-   CACAOVM - Verein zu Foerderung der freien virtuellen Machine CACAO
+   Copyright (C) 2007, 2008
+   CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
 
    This file is part of CACAO.
 
 
 */
 
+
 #include "config.h"
+
 #include <stdint.h>
 #include <errno.h>
 
-#if defined(HAVE_STRING_H)
-# include <string.h>
-#endif
-
 #include "mm/memory.h"
 
+#include "toolbox/list.h"
+
+#include "vm/assertion.h"
 #include "vm/global.h"
 #include "vm/vm.h"
 
-#include "toolbox/list.h"
+#include "vmcore/system.h"
 
-#include "vm/assertion.h"
 
 /* -ea/-da options ************************************************************/
 
@@ -47,13 +47,15 @@ int32_t  assertion_package_count  = 0;
 bool     assertion_user_enabled   = false;
 bool     assertion_system_enabled = false;
 
+
 /* assertion_ea_da *************************************************************
 
    Handle -ea:/-enableassertions: and -da:/-disableassertions: options.
 
 *******************************************************************************/
 
-void assertion_ea_da(const char *name, bool enabled) {
+void assertion_ea_da(const char *name, bool enabled)
+{
        bool              package;
        size_t            len;
        char             *buf;
@@ -66,13 +68,14 @@ void assertion_ea_da(const char *name, bool enabled) {
        }
 
        package = false;
-       len     = strlen(name);
+       len     = system_strlen(name);
 
        if (name[len - 1] == '/') {
                return;
        }
 
-       buf = strdup(name);
+       buf = system_strdup(name);
+
        if (buf == NULL) {
                vm_abort("assertion_ea_da: strdup failed: %s", strerror(errno));
        }
@@ -80,7 +83,7 @@ void assertion_ea_da(const char *name, bool enabled) {
        if ((len > 2) && (strcmp(name + (len - 3), "...") == 0)) {
                package = true;
                assertion_package_count += 1;
-#if defined(WITH_CLASSPATH_SUN)
+#if defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
                buf[len - 2] = '\0';
                buf[len - 3] = '/';
 #else
@@ -91,9 +94,10 @@ void assertion_ea_da(const char *name, bool enabled) {
                assertion_class_count += 1;
        }
 
-       len = strlen(buf);
+       len = system_strlen(buf);
+
        for (i = 0; i < len; i++) {
-#if defined(WITH_CLASSPATH_SUN)
+#if defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
                if (buf[i] == '.') {
                        buf[i] = '/';
                }
@@ -112,9 +116,11 @@ void assertion_ea_da(const char *name, bool enabled) {
        if (list_assertion_names == NULL) {
                list_assertion_names = list_create(OFFSET(assertion_name_t, linkage));
        }
+
        list_add_last(list_assertion_names, item);
 }
 
+
 /*
  * These are local overrides for various environment variables in Emacs.
  * Please do not remove this and leave it at the end of the file, where