argv_delete.c 589 B

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