IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 42808


Ignore:
Timestamp:
May 8, 2025, 11:37:15 AM (14 months ago)
Author:
eugene
Message:

fix an obscure mem-corruption issue; enable "macro create" and other macro sub-commands in lists (if,while,macro)

Location:
trunk/Ohana/src/opihi/lib.shell
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/lib.shell/CommandOps.c

    r39457 r42808  
    5959
    6060  free (commands[Nc].name);
    61   for (i = Nc + 1; i < Ncommands; i++)
     61  for (i = Nc + 1; i < Ncommands; i++) {
    6262    commands[i - 1] = commands[i];
     63  }
    6364  Ncommands --;
    64   REALLOCATE (commands, Command, Ncommands);
    6565  return (TRUE);
    6666}
  • trunk/Ohana/src/opihi/lib.shell/ListOps.c

    r40652 r42808  
    133133}
    134134
     135// this should return TRUE (is start of a new list-type environment)
     136// if the word following 'macro' is not one of the following:
     137// 'list', 'delete', 'read', 'write', 'edit'
    135138int is_macro_create (char *line) {
    136139
     
    150153  if (this_macro == NULL) return (FALSE);
    151154
     155  // the other macro subcommands do NOT start a new list environment
     156  if (!strcmp("create", this_macro)) {
     157    free (this_macro);
     158    return (TRUE);
     159  }
     160
    152161  cmd = find_macro_command (this_macro);
    153162  free (this_macro);
    154163
    155   if (cmd == NULL) {
    156     return (FALSE);
    157   }
    158 
    159   return (TRUE);
     164  if (cmd == NULL) return (TRUE);
     165
     166  return (FALSE);
    160167}
    161168
  • trunk/Ohana/src/opihi/lib.shell/MacroOps.c

    r16888 r42808  
    111111
    112112  FreeMacro (&macros[Nm]);
    113   for (i = Nm + 1; i < Nmacros; i++)
     113  for (i = Nm + 1; i < Nmacros; i++) {
    114114    macros[i - 1] = macros[i];
     115  }
    115116  Nmacros --;
    116117  return (TRUE);
  • trunk/Ohana/src/opihi/lib.shell/macro_create.c

    r31667 r42808  
    4545    cmd[0].func = macro_exec;
    4646    AddCommand (cmd);
    47     free (cmd);
     47    free (cmd); //
    4848    macro = NewMacro (argv[1]);
    4949  } else { /**** Old Macro ****/
Note: See TracChangeset for help on using the changeset viewer.