* src/vm/jit/stack.c (GET_NEW_VAR): Fixed macro argument.
[cacao.git] / src / vm / properties.c
index 94f75a7b77b964187dab0ea467ff79f0774ed82d..3b093650446068d04caede416319c7cb068a415d 100644 (file)
@@ -1,9 +1,9 @@
 /* src/vm/properties.c - handling commandline properties
 
-   Copyright (C) 1996-2005 R. Grafl, A. Krall, C. Kruegel, C. Oates,
-   R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
-   C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
-   Institut f. Computersprachen - TU Wien
+   Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
+   C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
+   E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
+   J. Wenninger, Institut f. Computersprachen - TU Wien
 
    This file is part of CACAO.
 
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-   02111-1307, USA.
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
 
-   Contact: cacao@complang.tuwien.ac.at
+   Contact: cacao@cacaojvm.org
 
    Authors: Christian Thalinger
 
    Changes:
 
-   $Id: properties.c 4145 2006-01-12 21:06:07Z twisti $
+   $Id: properties.c 5049 2006-06-23 12:07:26Z twisti $
 
 */
 
@@ -39,6 +39,8 @@
 
 #include "vm/types.h"
 
+#include "mm/memory.h"
+
 #include "vm/global.h"
 #include "native/include/java_lang_String.h"
 #include "native/include/java_util_Properties.h"
@@ -46,6 +48,7 @@
 #include "vm/method.h"
 #include "vm/options.h"
 #include "vm/stringlocal.h"
+#include "vm/vm.h"
 #include "vm/jit/asmpart.h"
 
 
@@ -76,9 +79,7 @@ static methodinfo *mput;
 
 bool properties_init(void)
 {
-       list_properties = NEW(list);
-
-       list_init(list_properties, OFFSET(list_properties_entry, linkage));
+       list_properties = list_create(OFFSET(list_properties_entry, linkage));
 
        /* everything's ok */
 
@@ -128,7 +129,7 @@ void properties_add(char *key, char *value)
        p->key   = key;
        p->value = value;
 
-       list_addlast(list_properties, p);
+       list_add_last_unsynced(list_properties, p);
 }
 
 
@@ -142,8 +143,11 @@ char *properties_get(char *key)
 {
        list_properties_entry *p;
 
-       for (p = list_first(list_properties); p != NULL;
-                p = list_next(list_properties, p)) {
+       /* We search backwards, so we get the newest entry for a key, as
+          the list may contain more than one entry for a specific key. */
+
+       for (p = list_last(list_properties); p != NULL;
+                p = list_prev(list_properties, p)) {
                if (strcmp(p->key, key) == 0)
                        return p->value;
        }
@@ -163,10 +167,10 @@ void properties_system_add(char *key, char *value)
        java_lang_String *k;
        java_lang_String *v;
 
-       k = javastring_new_char(key);
-       v = javastring_new_char(value);
+       k = javastring_new_from_utf_string(key);
+       v = javastring_new_from_utf_string(value);
 
-       ASM_CALLJAVAFUNCTION(mput, psystem, k, v, NULL);
+       (void) vm_call_method(mput, (java_objectheader *) psystem, k, v);
 }