Changeset 3242 for trunk


Ignore:
Timestamp:
Apr 30, 2007, 1:14:12 AM (18 years ago)
Author:
bird
Message:

Applied bash31-007

Location:
trunk/essentials/app-shells/bash
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/essentials/app-shells/bash/jobs.c

    r3232 r3242  
    849849{
    850850  sigset_t set, oset;
    851   int nsize, i, j;
     851  int nsize, i, j, ncur, nprev;
    852852  JOB **nlist;
    853853
     854  ncur = nprev = NO_JOB;
    854855  nsize = ((js.j_njobs + JOB_SLOTS - 1) / JOB_SLOTS);
    855856  nsize *= JOB_SLOTS;
     
    859860
    860861  BLOCK_CHILD (set, oset);
    861   nlist = (JOB **) xmalloc (nsize * sizeof (JOB *));
     862  nlist = (js.j_jobslots == nsize) ? jobs : (JOB **) xmalloc (nsize * sizeof (JOB *));
     863
    862864  for (i = j = 0; i < js.j_jobslots; i++)
    863865    if (jobs[i])
    864       nlist[j++] = jobs[i];
     866      {
     867        if (i == js.j_current)
     868          ncur = j;
     869        if (i == js.j_previous)
     870          nprev = j;
     871        nlist[j++] = jobs[i];
     872      }
     873
     874#if defined (DEBUG)
     875  itrace ("realloc_jobs_list: resize jobs list from %d to %d", js.j_jobslots, nsize);
     876  itrace ("realloc_jobs_list: j_lastj changed from %d to %d", js.j_lastj, (j > 0) ? j - 1 : 0);
     877  itrace ("realloc_jobs_list: j_njobs changed from %d to %d", js.j_njobs, (j > 0) ? j - 1 : 0);
     878#endif
    865879
    866880  js.j_firstj = 0;
    867   js.j_lastj = (j > 0) ? j - 1: 0;
     881  js.j_lastj = (j > 0) ? j - 1 : 0;
     882  js.j_njobs = j;
    868883  js.j_jobslots = nsize;
    869884
    870   free (jobs);
    871   jobs = nlist;
     885  /* Zero out remaining slots in new jobs list */
     886  for ( ; j < nsize; j++)
     887    nlist[j] = (JOB *)NULL;
     888
     889  if (jobs != nlist)
     890    {
     891      free (jobs);
     892      jobs = nlist;
     893    }
     894
     895  if (ncur != NO_JOB)
     896    js.j_current = ncur;
     897  if (nprev != NO_JOB)
     898    js.j_previous = nprev;
     899
     900  /* Need to reset these */
     901  if (js.j_current == NO_JOB || js.j_previous == NO_JOB || js.j_current > js.j_lastj || js.j_previous > js.j_lastj)
     902    reset_current ();
     903
     904#ifdef DEBUG
     905  itrace ("realloc_jobs_list: reset js.j_current (%d) and js.j_previous (%d)", js.j_current, js.j_previous);
     906#endif
    872907
    873908  UNBLOCK_CHILD (oset);
  • trunk/essentials/app-shells/bash/patchlevel.h

    r3241 r3242  
    2626   looks for to find the patch level (for the sccs version string). */
    2727
    28 #define PATCHLEVEL 6
     28#define PATCHLEVEL 7
    2929
    3030#endif /* _PATCHLEVEL_H_ */
Note: See TracChangeset for help on using the changeset viewer.