From 85760524cc4c5a86c7bafc341cb1924d36d0a4dc Mon Sep 17 00:00:00 2001 From: Mark Hindess Date: Wed, 16 Sep 2009 07:41:39 +0000 Subject: [PATCH] [r815644] Change hythread API to use 'const char*' for constant strings rather than 'char*'. To avoid some recent gcc compiler warnings (treated as errors). See http://markmail.org/message/xj76uxwu5h3ue2v3 --- vm/include/open/hythread.h | 10 +++++----- vm/thread/src/thread_classlib_defs.h | 4 ++-- vm/thread/src/thread_init.c | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/vm/include/open/hythread.h b/vm/include/open/hythread.h index 0f674b94..9f25b6d9 100644 --- a/vm/include/open/hythread.h +++ b/vm/include/open/hythread.h @@ -117,7 +117,7 @@ struct HyPortLibrary; #define HYTHREAD_LIB_FLAG_JLMTS_ENABLED 0x8000 typedef struct HyThreadMonitorTracing { - char* monitor_name; + const char* monitor_name; UDATA enter_count; UDATA slow_count; UDATA recursive_count; @@ -165,11 +165,11 @@ typedef struct HyThreadLibrary { void *entryarg); void (PVMCALL thread_detach) (struct HyThreadLibrary *threadLibraryFuncs, hythread_t thread); void (PVMCALL NORETURN thread_exit) (struct HyThreadLibrary *threadLibraryFuncs, hythread_monitor_t monitor); - UDATA *(PVMCALL thread_global) (struct HyThreadLibrary *threadLibraryFuncs, char *name); + UDATA *(PVMCALL thread_global) (struct HyThreadLibrary *threadLibraryFuncs, const char *name); IDATA (PVMCALL thread_monitor_destroy) (struct HyThreadLibrary *threadLibraryFuncs, hythread_monitor_t monitor); IDATA (PVMCALL thread_monitor_enter) (struct HyThreadLibrary *threadLibraryFuncs, hythread_monitor_t monitor); IDATA (PVMCALL thread_monitor_exit) (struct HyThreadLibrary *threadLibraryFuncs, hythread_monitor_t monitor); - IDATA (PVMCALL thread_monitor_init_with_name) (struct HyThreadLibrary *threadLibraryFuncs, hythread_monitor_t * handle, UDATA flags, char *name); + IDATA (PVMCALL thread_monitor_init_with_name) (struct HyThreadLibrary *threadLibraryFuncs, hythread_monitor_t * handle, UDATA flags, const char *name); IDATA (PVMCALL thread_monitor_notify) (struct HyThreadLibrary *threadLibraryFuncs, hythread_monitor_t monitor); IDATA (PVMCALL thread_monitor_notify_all) (struct HyThreadLibrary *threadLibraryFuncs, hythread_monitor_t monitor); IDATA (PVMCALL thread_monitor_wait) (struct HyThreadLibrary *threadLibraryFuncs, hythread_monitor_t monitor); @@ -288,7 +288,7 @@ hythread_monitor_init PROTOTYPE((hythread_monitor_t* handle, UDATA flags)); extern HY_CFUNC IDATA VMCALL hythread_sleep PROTOTYPE((I_64 millis)); extern HY_CFUNC UDATA* VMCALL -hythread_global PROTOTYPE((char* name)); +hythread_global PROTOTYPE((const char* name)); extern HY_CFUNC IDATA VMCALL hythread_tls_alloc_with_finalizer PROTOTYPE((hythread_tls_key_t* handle, hythread_tls_finalizer_t finalizer)); extern HY_CFUNC void VMCALL @@ -333,7 +333,7 @@ extern HY_CFUNC HyThreadMonitorTracing* VMCALL hythread_monitor_get_tracing PROTOTYPE((hythread_monitor_t monitor)); extern HY_CFUNC UDATA VMCALL hythread_get_priority PROTOTYPE((hythread_t thread)); -extern HY_CFUNC char* VMCALL +extern HY_CFUNC const char* VMCALL hythread_monitor_get_name PROTOTYPE((hythread_monitor_t monitor)); extern HY_CFUNC hythread_monitor_t VMCALL hythread_monitor_walk PROTOTYPE((hythread_monitor_t monitor)); diff --git a/vm/thread/src/thread_classlib_defs.h b/vm/thread/src/thread_classlib_defs.h index a91d7406..58a714ba 100644 --- a/vm/thread/src/thread_classlib_defs.h +++ b/vm/thread/src/thread_classlib_defs.h @@ -73,7 +73,7 @@ void VMCALL hythread_exit_cl(HyThreadLibrary *threadLibraryFuncs, hythread_monit } -UDATA * VMCALL hythread_global_cl(HyThreadLibrary *threadLibraryFuncs, char *name) +UDATA * VMCALL hythread_global_cl(HyThreadLibrary *threadLibraryFuncs, const char *name) { return hythread_global(name); } @@ -93,7 +93,7 @@ IDATA VMCALL hythread_monitor_exit_cl(HyThreadLibrary *threadLibraryFuncs, hythr return hythread_monitor_exit(monitor); } -IDATA VMCALL hythread_monitor_init_with_name_cl(HyThreadLibrary *threadLibraryFuncs, hythread_monitor_t * handle, UDATA flags, char *name) +IDATA VMCALL hythread_monitor_init_with_name_cl(HyThreadLibrary *threadLibraryFuncs, hythread_monitor_t * handle, UDATA flags, const char *name) { return hythread_monitor_init_with_name(handle, flags, name); } diff --git a/vm/thread/src/thread_init.c b/vm/thread/src/thread_init.c index 6d726cf2..7b18f92e 100644 --- a/vm/thread/src/thread_init.c +++ b/vm/thread/src/thread_init.c @@ -474,14 +474,14 @@ IDATA release_start_lock() { // need to be hashtable in the future */ #define TABLE_SIZE 256 -char *names[TABLE_SIZE]; +const char *names[TABLE_SIZE]; UDATA data[TABLE_SIZE]; int size = 0; /* * return index in array if found, -1 otherwise */ -int find_entry (char* name) { +int find_entry (const char* name) { // quick pass int i; for (i = 0; i < size; i++) { @@ -499,7 +499,7 @@ int find_entry (char* name) { } //add entry to the end of the array // return new entry index, -1 if failed. -int add_entry(char* name) { +int add_entry(const char* name) { int index = size++; if (index >= TABLE_SIZE-1) { return -1; @@ -520,7 +520,7 @@ int add_entry(char* name) { * 0 on failure. * */ -UDATA* VMCALL hythread_global (char* name) { +UDATA* VMCALL hythread_global (const char* name) { //hythread_monitor_enter(*p_global_monitor); int index = find_entry(name); if (index == -1) { -- 2.11.4.GIT