IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 11, 2006, 10:15:41 PM (19 years ago)
Author:
eugene
Message:

moved global List into ListOps.c

File:
1 edited

Legend:

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

    r9469 r10647  
    88 
    99  /* increase the shell level (Nlists) by one */
    10   Nlists ++;
    11   ThisList = Nlists;
    12   REALLOCATE (lists, List, MAX (ThisList, 0) + 1);
    13  
     10  ThisList = increase_list_depth();
     11  if (ThisList == 0) abort();
     12
    1413  /* copy the macro to the current list */
    15   lists[ThisList].Nlines = loop[0].Nlines;
    16   ALLOCATE (lists[ThisList].line, char *, MAX (lists[ThisList].Nlines, 1));
    17   for (j = 0; j < lists[ThisList].Nlines; j++) {
    18     lists[ThisList].line[j] = strcreate (loop[0].line[j]);
     14  for (j = 0; j < loop[0].Nlines; j++) {
     15    add_listentry (ThisList, loop[0].line[j]);
    1916  }
    2017
     
    2623  loop_continue = loop_break = FALSE;
    2724  status = TRUE;
    28   Nlines = lists[ThisList].Nlines;
    29   for (n = 0; (n < Nlines) && !interrupt; n++) {
    30     lists[ThisList].n = n;
    31     line = lists[ThisList].line[n];
    3225
     26  while (!interrupt) {
     27    line = get_next_listentry (ThisList);
     28    if (line == NULL) break;
    3329    status = multicommand (line);
    34 
    35     if (line != NULL) free (line);
    36     n = lists[ThisList].n;
    37     Nlines = lists[ThisList].Nlines;
     30    free (line);
    3831    if (auto_break && !status) loop_break = TRUE;
    3932    if (loop_break || loop_continue) break;
     
    4235
    4336  /* free remaining lines on the list, free the list, decrement the shell level */
    44   for (n ++; n < Nlines; n ++) {
    45       free (lists[ThisList].line[n]);
    46   }
    47   free (lists[ThisList].line);
    48   Nlists --;
    49   REALLOCATE (lists, List, MAX (Nlists, 0) + 1);
     37  /*** can we free a list which is not the bottom lists? */
     38  decrease_list_depth();
    5039
    5140  if (loop_break) return (FALSE);
Note: See TracChangeset for help on using the changeset viewer.