Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KlSyl-0002uL-Ox for qemu-devel@nongnu.org; Thu, 02 Oct 2008 14:32:47 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KlSyl-0002ty-5J for qemu-devel@nongnu.org; Thu, 02 Oct 2008 14:32:47 -0400 Received: from [199.232.76.173] (port=50960 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KlSyl-0002tr-28 for qemu-devel@nongnu.org; Thu, 02 Oct 2008 14:32:47 -0400 Received: from savannah.gnu.org ([199.232.41.3]:40828 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KlSyk-0003dW-Hj for qemu-devel@nongnu.org; Thu, 02 Oct 2008 14:32:46 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1KlSyj-0008WJ-K9 for qemu-devel@nongnu.org; Thu, 02 Oct 2008 18:32:45 +0000 Received: from blueswir1 by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1KlSyj-0008WB-15 for qemu-devel@nongnu.org; Thu, 02 Oct 2008 18:32:45 +0000 MIME-Version: 1.0 Errors-To: blueswir1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Blue Swirl Message-Id: Date: Thu, 02 Oct 2008 18:32:45 +0000 Subject: [Qemu-devel] [5399] Make monitor command tables const Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 5399 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5399 Author: blueswir1 Date: 2008-10-02 18:32:44 +0000 (Thu, 02 Oct 2008) Log Message: ----------- Make monitor command tables const Modified Paths: -------------- trunk/monitor.c Modified: trunk/monitor.c =================================================================== --- trunk/monitor.c 2008-10-02 18:29:22 UTC (rev 5398) +++ trunk/monitor.c 2008-10-02 18:32:44 UTC (rev 5399) @@ -66,8 +66,8 @@ static CharDriverState *monitor_hd[MAX_MON]; static int hide_banner; -static term_cmd_t term_cmds[]; -static term_cmd_t info_cmds[]; +static const term_cmd_t term_cmds[]; +static const term_cmd_t info_cmds[]; static uint8_t term_outbuf[1024]; static int term_outbuf_index; @@ -175,9 +175,9 @@ return 0; } -static void help_cmd1(term_cmd_t *cmds, const char *prefix, const char *name) +static void help_cmd1(const term_cmd_t *cmds, const char *prefix, const char *name) { - term_cmd_t *cmd; + const term_cmd_t *cmd; for(cmd = cmds; cmd->name != NULL; cmd++) { if (!name || !strcmp(name, cmd->name)) @@ -192,7 +192,7 @@ } else { help_cmd1(term_cmds, "", name); if (name && !strcmp(name, "log")) { - CPULogItem *item; + const CPULogItem *item; term_printf("Log items (comma separated):\n"); term_printf("%-10s %s\n", "none", "remove all logs"); for(item = cpu_log_items; item->mask != 0; item++) { @@ -221,7 +221,7 @@ static void do_info(const char *item) { - term_cmd_t *cmd; + const term_cmd_t *cmd; void (*handler)(void); if (!item) @@ -1378,7 +1378,7 @@ } #endif -static term_cmd_t term_cmds[] = { +static const term_cmd_t term_cmds[] = { { "help|?", "s?", do_help, "[cmd]", "show the help" }, { "commit", "s", do_commit, @@ -1460,7 +1460,7 @@ { NULL, NULL, }, }; -static term_cmd_t info_cmds[] = { +static const term_cmd_t info_cmds[] = { { "version", "", do_info_version, "", "show the version of qemu" }, { "network", "", do_info_network, @@ -1533,12 +1533,12 @@ typedef struct MonitorDef { const char *name; int offset; - target_long (*get_value)(struct MonitorDef *md, int val); + target_long (*get_value)(const struct MonitorDef *md, int val); int type; } MonitorDef; #if defined(TARGET_I386) -static target_long monitor_get_pc (struct MonitorDef *md, int val) +static target_long monitor_get_pc (const struct MonitorDef *md, int val) { CPUState *env = mon_get_cpu(); if (!env) @@ -1548,7 +1548,7 @@ #endif #if defined(TARGET_PPC) -static target_long monitor_get_ccr (struct MonitorDef *md, int val) +static target_long monitor_get_ccr (const struct MonitorDef *md, int val) { CPUState *env = mon_get_cpu(); unsigned int u; @@ -1564,7 +1564,7 @@ return u; } -static target_long monitor_get_msr (struct MonitorDef *md, int val) +static target_long monitor_get_msr (const struct MonitorDef *md, int val) { CPUState *env = mon_get_cpu(); if (!env) @@ -1572,7 +1572,7 @@ return env->msr; } -static target_long monitor_get_xer (struct MonitorDef *md, int val) +static target_long monitor_get_xer (const struct MonitorDef *md, int val) { CPUState *env = mon_get_cpu(); if (!env) @@ -1580,7 +1580,7 @@ return ppc_load_xer(env); } -static target_long monitor_get_decr (struct MonitorDef *md, int val) +static target_long monitor_get_decr (const struct MonitorDef *md, int val) { CPUState *env = mon_get_cpu(); if (!env) @@ -1588,7 +1588,7 @@ return cpu_ppc_load_decr(env); } -static target_long monitor_get_tbu (struct MonitorDef *md, int val) +static target_long monitor_get_tbu (const struct MonitorDef *md, int val) { CPUState *env = mon_get_cpu(); if (!env) @@ -1596,7 +1596,7 @@ return cpu_ppc_load_tbu(env); } -static target_long monitor_get_tbl (struct MonitorDef *md, int val) +static target_long monitor_get_tbl (const struct MonitorDef *md, int val) { CPUState *env = mon_get_cpu(); if (!env) @@ -1607,7 +1607,7 @@ #if defined(TARGET_SPARC) #ifndef TARGET_SPARC64 -static target_long monitor_get_psr (struct MonitorDef *md, int val) +static target_long monitor_get_psr (const struct MonitorDef *md, int val) { CPUState *env = mon_get_cpu(); if (!env) @@ -1616,7 +1616,7 @@ } #endif -static target_long monitor_get_reg(struct MonitorDef *md, int val) +static target_long monitor_get_reg(const struct MonitorDef *md, int val) { CPUState *env = mon_get_cpu(); if (!env) @@ -1625,7 +1625,7 @@ } #endif -static MonitorDef monitor_defs[] = { +static const MonitorDef monitor_defs[] = { #ifdef TARGET_I386 #define SEG(name, seg) \ @@ -1876,7 +1876,7 @@ /* return 0 if OK, -1 if not found, -2 if no CPU defined */ static int get_monitor_def(target_long *pval, const char *name) { - MonitorDef *md; + const MonitorDef *md; void *ptr; for(md = monitor_defs; md->name != NULL; md++) { @@ -2170,7 +2170,7 @@ const char *p, *pstart, *typestr; char *q; int c, nb_args, len, i, has_arg; - term_cmd_t *cmd; + const term_cmd_t *cmd; char cmdname[256]; char buf[1024]; void *str_allocated[MAX_ARGS]; @@ -2607,7 +2607,7 @@ char *args[MAX_ARGS]; int nb_args, i, len; const char *ptype, *str; - term_cmd_t *cmd; + const term_cmd_t *cmd; const KeyDef *key; parse_cmdline(cmdline, &nb_args, args);