argv_delete.c 581 B

123456789101112131415161718192021222324252627282930
  1. /*
  2. * argv_delete.c
  3. */
  4. #include "private.h"
  5. #include "lub/string.h"
  6. #include <stdlib.h>
  7. /*--------------------------------------------------------- */
  8. static void
  9. lub_argv_fini(lub_argv_t *this)
  10. {
  11. unsigned i;
  12. for(i = 0;
  13. i < this->argc;
  14. i++)
  15. {
  16. lub_string_free(this->argv[i].arg);
  17. }
  18. free(this->argv);
  19. this->argv = NULL;
  20. }
  21. /*--------------------------------------------------------- */
  22. void
  23. lub_argv_delete(lub_argv_t *this)
  24. {
  25. lub_argv_fini(this);
  26. free(this);
  27. }
  28. /*--------------------------------------------------------- */