Changeset 3922
- Timestamp:
- May 12, 2005, 10:09:10 PM (21 years ago)
- Location:
- trunk/Ohana/src/opihi
- Files:
-
- 9 edited
-
cmd.basic/quit.c (modified) (2 diffs)
-
cmd.basic/run_if.c (modified) (1 diff)
-
cmd.basic/run_while.c (modified) (2 diffs)
-
cmd.data/select.c (modified) (2 diffs)
-
cmd.data/set.c (modified) (3 diffs)
-
cmd.data/subset.c (modified) (2 diffs)
-
lib.shell/ListOps.c (modified) (4 diffs)
-
lib.shell/expand_vars.c (modified) (1 diff)
-
lib.shell/expand_vectors.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/cmd.basic/quit.c
r3905 r3922 5 5 int state; 6 6 7 print_ncals (); 7 8 cleanup (); 8 9 … … 12 13 } 13 14 14 ohana_memdump (0);15 15 exit (state); 16 16 -
trunk/Ohana/src/opihi/cmd.basic/run_if.c
r3907 r3922 32 32 if (val == NULL) return (FALSE); 33 33 logic = atof (val); /* warning: round-off error is a danger */ 34 free (val); 34 35 35 36 if (BreakOnTrue) { -
trunk/Ohana/src/opihi/cmd.basic/run_while.c
r3907 r3922 18 18 if (val == NULL) return (FALSE); 19 19 logic = atof (val); /* warning: round-off error is a danger */ 20 free (val); 20 21 21 22 NLINES = D_NLINES; … … 85 86 if (val == NULL) return (FALSE); 86 87 logic = atof (val); /* warning: round-off error is a danger */ 88 free (val); 87 89 } while (logic && !interrupt); 88 90 loop_continue = loop_break = FALSE; -
trunk/Ohana/src/opihi/cmd.data/select.c
r2598 r3922 35 35 36 36 DeleteVector (tvec); 37 free (out); 37 38 return (TRUE); 38 39 … … 41 42 DeleteVector (ovec); 42 43 DeleteNamedVector (out); 44 free (out); 43 45 return (FALSE); 44 46 } -
trunk/Ohana/src/opihi/cmd.data/set.c
r2598 r3922 21 21 case 0: 22 22 set_str_variable (argv[1], out); 23 free (out); 23 24 break; 24 25 … … 26 27 if (!MoveNamedVector (argv[1], out)) { 27 28 DeleteNamedVector (out); 29 free (out); 28 30 fprintf (stderr, "invalid output vector name\n"); 29 31 return (FALSE); 30 32 } 33 free (out); 31 34 break; 32 35 … … 34 37 if (!MoveNamedBuffer (argv[1], out)) { 35 38 DeleteNamedBuffer (out); 39 free (out); 36 40 fprintf (stderr, "invalid output matrix name\n"); 37 41 return (FALSE); 38 42 } 43 free (out); 39 44 break; 40 45 } -
trunk/Ohana/src/opihi/cmd.data/subset.c
r3900 r3922 39 39 40 40 DeleteVector (tvec); 41 free (out); 41 42 return (TRUE); 42 43 … … 45 46 DeleteVector (ovec); 46 47 DeleteNamedVector (out); 48 free (out); 47 49 return (FALSE); 48 50 } -
trunk/Ohana/src/opihi/lib.shell/ListOps.c
r2598 r3922 39 39 int is_for_loop (char *line) { 40 40 41 int status; 41 42 char *comm; 42 43 43 44 comm = thisword (line); 44 45 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); 53 50 } 54 51 55 52 int is_macro_create (char *line) { 56 53 57 int i, N ;54 int i, N, status; 58 55 char *comm; 59 56 char *this_macro; 60 57 58 comm = thisword (line); 59 if (comm == (char *) NULL) return (FALSE); 61 60 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); 69 64 70 65 this_macro = thisword (nextword (line)); 71 66 72 if (this_macro == (char *)NULL) { 73 return (FALSE); 74 } 67 if (this_macro == (char *)NULL) return (FALSE); 75 68 76 69 N = sizeof (in_macro) / sizeof (Command); … … 101 94 if (strcmp (comm, "if")) goto escape; 102 95 96 /* if (cond) break does not define a complete block */ 103 97 if ((temp != NULL) && !strcmp (temp, "break")) goto escape; 104 98 105 free (comm); 99 if (temp != NULL) free (temp); 100 if (comm != NULL) free (comm); 106 101 return (TRUE); 107 102 … … 114 109 int is_loop (char *line) { 115 110 111 int status; 116 112 char *comm; 117 113 … … 119 115 if (comm == (char *) NULL) return (FALSE); 120 116 121 if (strcmp (comm, "while")) { 122 free (comm); 123 return (FALSE); 124 } 117 status = !strcmp (comm, "while"); 125 118 free (comm); 126 return ( TRUE);119 return (status); 127 120 } 128 121 -
trunk/Ohana/src/opihi/lib.shell/expand_vars.c
r2598 r3922 44 44 if ((*V1 == '=') || !strcmp (V1, "++") || !strcmp (V1, "--")) { 45 45 *N = *L; 46 free (V0); 46 47 continue; 47 48 } -
trunk/Ohana/src/opihi/lib.shell/expand_vectors.c
r2792 r3922 19 19 if (L == NULL) { 20 20 free (newline); 21 free (tmpline); 21 22 return (line); 22 23 } … … 45 46 if (val == NULL) goto dumpline; /* not a valid vector subscript */ 46 47 } 48 I = atoi (val); 49 free (val); 50 47 51 /* find vector name */ 48 52 for (w = p - 1; (w >= line) && !whitespace(*w) && (isalnum(*w) || (*w == ':') || (*w == '_')); w--); … … 51 55 strncpy (tmpline, w, n); 52 56 tmpline[n] = 0; 53 if ((vec = SelectVector (tmpline, OLDVECTOR, TRUE)) == NULL) { 54 free (val); 55 goto dumpline; 56 } 57 if ((vec = SelectVector (tmpline, OLDVECTOR, TRUE)) == NULL) goto dumpline; 58 57 59 /* find vector element */ 58 I = atoi (val);59 free (val);60 60 if (I >= vec[0].Nelements) { 61 61 fprintf (stderr, "vector subscript out of range\n");
Note:
See TracChangeset
for help on using the changeset viewer.
