[BACK]Return to sort.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / sort

Diff for /src/usr.bin/sort/sort.c between version 1.56 and 1.57

version 1.56, 2015/04/01 20:20:22 version 1.57, 2015/04/01 20:24:12
Line 554 
Line 554 
                 goto end;                  goto end;
   
         len = pmatch[1].rm_eo - pmatch[1].rm_so;          len = pmatch[1].rm_eo - pmatch[1].rm_so;
         f = sort_malloc((len + 1) * sizeof(char));  
   
         strncpy(f, s + pmatch[1].rm_so, len);          f = sort_malloc(len + 1);
           memcpy(f, s + pmatch[1].rm_so, len);
         f[len] = '\0';          f[len] = '\0';
   
         if (second) {          if (second) {
Line 581 
Line 581 
   
         if (pmatch[2].rm_eo > pmatch[2].rm_so) {          if (pmatch[2].rm_eo > pmatch[2].rm_so) {
                 len = pmatch[2].rm_eo - pmatch[2].rm_so - 1;                  len = pmatch[2].rm_eo - pmatch[2].rm_so - 1;
                 c = sort_malloc((len + 1) * sizeof(char));  
   
                 strncpy(c, s + pmatch[2].rm_so + 1, len);                  c = sort_malloc(len + 1);
                   memcpy(c, s + pmatch[2].rm_so + 1, len);
                 c[len] = '\0';                  c[len] = '\0';
   
                 if (second) {                  if (second) {
Line 658 
Line 658 
   
                         if (size1 < 1)                          if (size1 < 1)
                                 return -1;                                  return -1;
                         pos1 = sort_malloc((size1 + 1) * sizeof(char));  
   
                         strncpy(pos1, s, size1);                          pos1 = sort_malloc(size1 + 1);
                           memcpy(pos1, s, size1);
                         pos1[size1] = '\0';                          pos1[size1] = '\0';
   
                         ret = parse_pos(pos1, ks, mef_flags, false);                          ret = parse_pos(pos1, ks, mef_flags, false);
Line 711 
Line 711 
                 goto end;                  goto end;
   
         len = pmatch[1].rm_eo - pmatch[1].rm_so;          len = pmatch[1].rm_eo - pmatch[1].rm_so;
         f = sort_malloc((len + 1) * sizeof(char));  
   
         strncpy(f, s + pmatch[1].rm_so, len);          f = sort_malloc(len + 1);
           memcpy(f, s + pmatch[1].rm_so, len);
         f[len] = '\0';          f[len] = '\0';
   
         errno = 0;          errno = 0;
Line 723 
Line 723 
   
         if (pmatch[2].rm_eo > pmatch[2].rm_so) {          if (pmatch[2].rm_eo > pmatch[2].rm_so) {
                 len = pmatch[2].rm_eo - pmatch[2].rm_so - 1;                  len = pmatch[2].rm_eo - pmatch[2].rm_so - 1;
                 c = sort_malloc((len + 1) * sizeof(char));  
   
                 strncpy(c, s + pmatch[2].rm_so + 1, len);                  c = sort_malloc((len + 1) * sizeof(char));
                   memcpy(c, s + pmatch[2].rm_so + 1, len);
                 c[len] = '\0';                  c[len] = '\0';
   
                 errno = 0;                  errno = 0;
Line 740 
Line 740 
   
                 if (len >= sopts_size)                  if (len >= sopts_size)
                         errx(2, "Invalid key position");                          errx(2, "Invalid key position");
                 strncpy(sopts, s + pmatch[3].rm_so, len);                  memcpy(sopts, s + pmatch[3].rm_so, len);
                 sopts[len] = '\0';                  sopts[len] = '\0';
         }          }
   

Legend:
Removed from v.1.56  
changed lines
  Added in v.1.57