/* 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 ************************************************************/
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;
}
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));
}
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
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] = '/';
}
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