Changeset 0a0fb74


Ignore:
Timestamp:
Aug 15, 2009, 7:08:19 PM (15 years ago)
Author:
Anders Kaseorg <andersk@mit.edu>
Branches:
master, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
a352029b
Parents:
3f8514b
git-author:
Anders Kaseorg <andersk@mit.edu> (08/04/09 02:37:58)
git-committer:
Anders Kaseorg <andersk@mit.edu> (08/15/09 19:08:19)
Message:
Add const qualifiers for owl_cmd *.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • cmd.c

    r3f8514b r0a0fb74  
    55#include "owl.h"
    66
    7 extern owl_cmd commands_to_init[];
     7extern const owl_cmd commands_to_init[];
    88
    99/**************************************************************************/
     
    2323
    2424/* for bulk initialization at startup */
    25 int owl_cmddict_add_from_list(owl_cmddict *cd, owl_cmd *cmds) {
    26   owl_cmd *cur;
     25int owl_cmddict_add_from_list(owl_cmddict *cd, const owl_cmd *cmds) {
     26  const owl_cmd *cur;
    2727  int ret = 0;
    2828  for (cur = cmds; cur->name != NULL; cur++) {
     
    3838}
    3939
    40 owl_cmd *owl_cmddict_find(const owl_cmddict *d, const char *name) {
     40const owl_cmd *owl_cmddict_find(const owl_cmddict *d, const char *name) {
    4141  return owl_dict_find_element(d, name);
    4242}
     
    5555}
    5656
    57 int owl_cmddict_add_cmd(owl_cmddict *cd, owl_cmd * cmd) {
     57int owl_cmddict_add_cmd(owl_cmddict *cd, const owl_cmd * cmd) {
    5858  owl_cmd * newcmd = owl_malloc(sizeof(owl_cmd));
    5959  if(owl_cmd_create_from_template(newcmd, cmd) < 0) {
     
    6767char *_owl_cmddict_execute(const owl_cmddict *cd, const owl_context *ctx, const char *const *argv, int argc, const char *buff) {
    6868  char *retval = NULL;
    69   owl_cmd *cmd;
     69  const owl_cmd *cmd;
    7070
    7171  if (!strcmp(argv[0], "")) {
     
    132132
    133133/* sets up a new command based on a template, copying strings */
    134 int owl_cmd_create_from_template(owl_cmd *cmd, owl_cmd *templ) {
     134int owl_cmd_create_from_template(owl_cmd *cmd, const owl_cmd *templ) {
    135135  *cmd = *templ;
    136136  if (!templ->name) return(-1);
     
    162162}
    163163
    164 int owl_cmd_is_context_valid(owl_cmd *cmd, const owl_context *ctx) {
     164int owl_cmd_is_context_valid(const owl_cmd *cmd, const owl_context *ctx) {
    165165  if (owl_context_matches(ctx, cmd->validctx)) return 1;
    166166  else return 0;
    167167}
    168168
    169 char *owl_cmd_execute(owl_cmd *cmd, const owl_cmddict *cd, const owl_context *ctx, int argc, const char *const *argv, const char *cmdbuff) {
     169char *owl_cmd_execute(const owl_cmd *cmd, const owl_cmddict *cd, const owl_context *ctx, int argc, const char *const *argv, const char *cmdbuff) {
    170170  static int alias_recurse_depth = 0;
    171171  int ival=0;
     
    238238
    239239/* returns a reference */
    240 const char *owl_cmd_get_summary(owl_cmd *cmd) {
     240const char *owl_cmd_get_summary(const owl_cmd *cmd) {
    241241  return cmd->summary;
    242242}
    243243
    244244/* returns a summary line describing this keymap.  the caller must free. */
    245 char *owl_cmd_describe(owl_cmd *cmd) {
     245char *owl_cmd_describe(const owl_cmd *cmd) {
    246246  char *s;
    247247  int slen;
  • commands.c

    re19eb97 r0a0fb74  
    4040
    4141
    42 owl_cmd commands_to_init[]
     42const owl_cmd commands_to_init[]
    4343  = {
    4444  OWLCMD_ARGS("zlog", owl_command_zlog, OWL_CTX_ANY,
  • functions.c

    r77bced3 r0a0fb74  
    3939}
    4040
    41 owl_cmd *owl_function_get_cmd(const char *name)
     41const owl_cmd *owl_function_get_cmd(const char *name)
    4242{
    4343  return owl_cmddict_find(owl_global_get_cmddict(&g), name);
     
    110110char *owl_function_cmd_describe(const char *name)
    111111{
    112   owl_cmd *cmd = owl_cmddict_find(owl_global_get_cmddict(&g), name);
     112  const owl_cmd *cmd = owl_cmddict_find(owl_global_get_cmddict(&g), name);
    113113  if (cmd) return owl_cmd_describe(cmd);
    114114  else return(NULL);
  • keymap.c

    re19eb97 r0a0fb74  
    102102  for (i=0; i<nbindings; i++) {
    103103    char buff[100];
    104     owl_cmd *cmd;
     104    const owl_cmd *cmd;
    105105    const char *tmpdesc, *desc = "";
    106106
  • perlconfig.c

    re19eb97 r0a0fb74  
    452452}
    453453
    454 char *owl_perlconfig_perlcmd(owl_cmd *cmd, int argc, const char *const *argv)
     454char *owl_perlconfig_perlcmd(const owl_cmd *cmd, int argc, const char *const *argv)
    455455{
    456456  int i, count;
Note: See TracChangeset for help on using the changeset viewer.