MCPcopy Index your code
hub / github.com/RsyncProject/rsync / init_set_compression

Function init_set_compression

token.c:172–222  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

170}
171
172static void init_set_compression(void)
173{
174 const char *f;
175 char *t, *start;
176
177 if (skip_compress)
178 add_nocompress_suffixes(skip_compress);
179
180 /* A non-daemon transfer skips the default suffix list if the
181 * user specified --skip-compress. */
182 if (skip_compress && module_id < 0)
183 f = "";
184 else
185 f = lp_dont_compress(module_id);
186
187 match_list = t = new_array(char, strlen(f) + 2);
188
189 per_file_default_level = do_compression_level;
190
191 while (*f) {
192 if (*f == ' ') {
193 f++;
194 continue;
195 }
196
197 start = t;
198 do {
199 if (isUpper(f))
200 *t++ = toLower(f);
201 else
202 *t++ = *f;
203 } while (*++f != ' ' && *f);
204 *t++ = '\0';
205
206 if (t - start == 1+1 && *start == '*') {
207 /* Optimize a match-string of "*". */
208 *match_list = '\0';
209 suftree = NULL;
210 per_file_default_level = skip_compression_level;
211 break;
212 }
213
214 /* Move *.foo items into the stuffix tree. */
215 if (*start == '*' && start[1] == '.' && start[2]
216 && !strpbrk(start+2, ".?*")) {
217 add_suffix(&suftree, start[2], start+3);
218 t = start;
219 }
220 }
221 *t++ = '\0';
222}
223
224/* determine the compression level based on a wildcard filename list */
225void set_compression(const char *fname)

Callers 1

set_compressionFunction · 0.85

Calls 5

add_nocompress_suffixesFunction · 0.85
isUpperFunction · 0.85
toLowerFunction · 0.85
strpbrkFunction · 0.85
add_suffixFunction · 0.85

Tested by

no test coverage detected