IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 12, 2005, 10:09:10 PM (21 years ago)
Author:
eugene
Message:

cleaned up memory leaks

File:
1 edited

Legend:

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

    r2598 r3922  
    3939int is_for_loop (char *line) {
    4040
     41  int status;
    4142  char *comm;
    4243
    4344  comm = thisword (line);
    4445  if (comm == (char *) NULL) return (FALSE);
    45 
    46   if (strcmp (comm, "for")) {
    47     free (comm);
    48     return (FALSE);
    49   }
    50 
    51   return (TRUE);
    52 
     46 
     47  status = !strcmp (comm, "for");
     48  free (comm);
     49  return (status);
    5350}
    5451
    5552int is_macro_create (char *line) {
    5653
    57   int i, N;
     54  int i, N, status;
    5855  char *comm;
    5956  char *this_macro;
    6057
     58  comm = thisword (line);
     59  if (comm == (char *) NULL) return (FALSE);
    6160
    62   comm = thisword (line);
    63   if (comm == (char *) NULL)
    64     return (FALSE);
    65   if (strcmp (comm, "macro")) {
    66     free (comm);
    67     return (FALSE);
    68   }
     61  status = !strcmp (comm, "macro");
     62  free (comm);
     63  if (!status) return (FALSE);
    6964 
    7065  this_macro = thisword (nextword (line));
    7166
    72   if (this_macro == (char *)NULL) {
    73     return (FALSE);
    74   }
     67  if (this_macro == (char *)NULL) return (FALSE);
    7568
    7669  N = sizeof (in_macro) / sizeof (Command);
     
    10194  if (strcmp (comm, "if")) goto escape;
    10295
     96  /* if (cond) break does not define a complete block */
    10397  if ((temp != NULL) && !strcmp (temp, "break")) goto escape;
    10498
    105   free (comm);
     99  if (temp != NULL) free (temp);
     100  if (comm != NULL) free (comm);
    106101  return (TRUE);
    107102
     
    114109int is_loop (char *line) {
    115110
     111  int status;
    116112  char *comm;
    117113
     
    119115  if (comm == (char *) NULL) return (FALSE);
    120116
    121   if (strcmp (comm, "while")) {
    122     free (comm);
    123     return (FALSE);
    124   }
     117  status = !strcmp (comm, "while");
    125118  free (comm);
    126   return (TRUE);
     119  return (status);
    127120}
    128121
Note: See TracChangeset for help on using the changeset viewer.