Fossil

Check-in [b878923997]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Replaced a complicated bit of logic with something slighlty less complicated, having the same effect. The glob parser used a mix of second-clause for-loop testing and internal break and continue checks without any other internal processing inside the loop. Combining all of this into a single expression requires the line to wrap (bad for clarity) but it does make clear all of the conditions required for this loop to continue iterating. I think it's a net improvement in clarity, though the margin is admittedly small. Testing shows no regression in functionality, limiting this non-functional change to a style improvement.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: b878923997bbcf1eded6861a357b5ab454bb442369effe1c9eea20f2d9498393
User & Date: wyoung 2023-05-22 21:27:42.698
Context
2023-05-22
21:32
Updated the function comment on glob_create() to match what it actually does. check-in: c43205d738 user: wyoung tags: trunk
21:27
Replaced a complicated bit of logic with something slighlty less complicated, having the same effect. The glob parser used a mix of second-clause for-loop testing and internal break and continue checks without any other internal processing inside the loop. Combining all of this into a single expression requires the line to wrap (bad for clarity) but it does make clear all of the conditions required for this loop to continue iterating. I think it's a net improvement in clarity, though the margin is admittedly small. Testing shows no regression in functionality, limiting this non-functional change to a style improvement. check-in: b878923997 user: wyoung tags: trunk
21:07
Reworked the prior commit's changelog entry to be more accurate and to match preexisting style. check-in: 8ce70b4c0c user: wyoung tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/glob.c.
124
125
126
127
128
129
130
131
132
133
134

135
136
137
138
139
140
141
      delimiter = z[0];
      z++;
    }else{
      delimiter = ',';
    }
    p->azPattern = fossil_realloc(p->azPattern, (p->nPattern+1)*sizeof(char*) );
    p->azPattern[p->nPattern++] = z;
    /* Find the next delimter (or the end of the string). */
    for(i=0; z[i] && z[i]!=delimiter; i++){
      if( delimiter!=',' ) continue; /* If quoted, keep going. */
      if( fossil_isspace(z[i]) ) break; /* If space, stop. */

    }
    if( z[i]==0 ) break;
    z[i] = 0;
    z += i+1;
  }
  return p;
}







|
|
<
|
>







124
125
126
127
128
129
130
131
132

133
134
135
136
137
138
139
140
141
      delimiter = z[0];
      z++;
    }else{
      delimiter = ',';
    }
    p->azPattern = fossil_realloc(p->azPattern, (p->nPattern+1)*sizeof(char*) );
    p->azPattern[p->nPattern++] = z;
    /* Find the next delimiter (or the end of the string). */
    for(i=0; z[i] && z[i]!=delimiter &&

        !(delimiter==',' && fossil_isspace(z[i])); i++){
      /* keep looking for the end of the glob pattern */
    }
    if( z[i]==0 ) break;
    z[i] = 0;
    z += i+1;
  }
  return p;
}