/[baselayout]/trunk/src/mountinfo.c
Gentoo

Diff of /trunk/src/mountinfo.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 2906 Revision 2908
228 228
229#else 229#else
230# error "Operating system not supported!" 230# error "Operating system not supported!"
231#endif 231#endif
232 232
233static regex_t *get_regex (char *string) 233static regex_t *get_regex (const char *string)
234{ 234{
235 regex_t *reg = rc_xmalloc (sizeof (regex_t)); 235 regex_t *reg = rc_xmalloc (sizeof (regex_t));
236 int result; 236 int result;
237 char buffer[256]; 237 char buffer[256];
238 238
277 int result; 277 int result;
278 278
279#define DO_REG(_var) \ 279#define DO_REG(_var) \
280 if (_var) free (_var); \ 280 if (_var) free (_var); \
281 _var = get_regex (optarg); 281 _var = get_regex (optarg);
282#define REG_FREE(_var) \
283 if (_var) { regfree (_var); free (_var); }
282 284
283 memset (&args, 0, sizeof (struct args)); 285 memset (&args, 0, sizeof (struct args));
284 args.mount_type = mount_to; 286 args.mount_type = mount_to;
285 287
286 while ((opt = getopt_long (argc, argv, getoptstring, 288 while ((opt = getopt_long (argc, argv, getoptstring,
331 rc_strlist_add (&args.mounts, argv[optind++]); 333 rc_strlist_add (&args.mounts, argv[optind++]);
332 } 334 }
333 335
334 nodes = find_mounts (&args); 336 nodes = find_mounts (&args);
335 337
336 if (args.fstype_regex) 338 REG_FREE (args.fstype_regex);
337 regfree (args.fstype_regex);
338 if (args.skip_fstype_regex) 339 REG_FREE (args.skip_fstype_regex);
339 regfree (args.skip_fstype_regex);
340 if (args.node_regex) 340 REG_FREE (args.node_regex);
341 regfree (args.node_regex);
342 if (args.skip_node_regex) 341 REG_FREE (args.skip_node_regex);
343 regfree (args.skip_node_regex);
344 if (args.options_regex) 342 REG_FREE (args.options_regex);
345 regfree (args.options_regex);
346 if (args.skip_options_regex) 343 REG_FREE (args.skip_options_regex);
347 regfree (args.skip_options_regex);
348 344
349 rc_strlist_reverse (nodes); 345 rc_strlist_reverse (nodes);
350 346
351 result = EXIT_FAILURE; 347 result = EXIT_FAILURE;
352 STRLIST_FOREACH (nodes, n, i) { 348 STRLIST_FOREACH (nodes, n, i) {
358 printf ("%s\n", n); 354 printf ("%s\n", n);
359 result = EXIT_SUCCESS; 355 result = EXIT_SUCCESS;
360 } 356 }
361 rc_strlist_free (nodes); 357 rc_strlist_free (nodes);
362 358
363 if (point_regex) 359 REG_FREE (point_regex);
364 regfree (point_regex);
365 if (skip_point_regex) 360 REG_FREE (skip_point_regex);
366 regfree (skip_point_regex);
367 361
368 exit (result); 362 exit (result);
369} 363}

Legend:
Removed from v.2906  
changed lines
  Added in v.2908

  ViewVC Help
Powered by ViewVC 1.1.20