/* src/toolbox/util.c - contains some utility functions
- 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
+ Copyright (C) 1996-2005, 2006, 2008
+ CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
This file is part of CACAO.
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- Contact: cacao@cacaojvm.org
-
- Authors: Christian Thalinger
-
- Changes:
-
- $Id: util.c 4960 2006-05-26 12:19:43Z edwin $
-
*/
+#include "config.h"
+
#include <assert.h>
#include <errno.h>
#include <stdarg.h>
#include "vm/types.h"
-#include "mm/memory.h"
-#include "vm/exceptions.h"
-#include "vm/stringlocal.h"
-
-
-/* getcwd **********************************************************************
-
- Return the current working directory.
-
- RETURN VALUE:
- pointer to a char array allocated by MNEW, or
- NULL if memory could not be allocated.
-
-*******************************************************************************/
-
-char *_Jv_getcwd(void)
-{
- char *buf;
- s4 size;
-
- size = 1024;
-
- buf = MNEW(char, size);
-
- while (buf) {
- if (getcwd(buf, size) != NULL)
- return buf;
-
- MFREE(buf, char, size);
-
- /* too small buffer or a more serious problem */
-
- if (errno != ERANGE)
- throw_cacao_exception_exit(string_java_lang_InternalError,
- strerror(errno));
-
- /* double the buffer size */
-
- size *= 2;
-
- buf = MNEW(char, size);
- }
-
- return NULL;
-}
+#include "mm/memory.hpp"
+#include "vm/vm.hpp"
/* get_variable_message_length *************************************************