nv_pair.c 958 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /* nv_pair.c - the opkg package management system
  2. Carl D. Worth
  3. Copyright (C) 2001 University of Southern California
  4. This program is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU General Public License as
  6. published by the Free Software Foundation; either version 2, or (at
  7. your option) any later version.
  8. This program is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. General Public License for more details.
  12. */
  13. #include "nv_pair.h"
  14. #include "libbb/libbb.h"
  15. int nv_pair_init(nv_pair_t * nv_pair, const char *name, const char *value)
  16. {
  17. nv_pair->name = xstrdup(name);
  18. nv_pair->value = xstrdup(value);
  19. return 0;
  20. }
  21. void nv_pair_deinit(nv_pair_t * nv_pair)
  22. {
  23. free(nv_pair->name);
  24. nv_pair->name = NULL;
  25. free(nv_pair->value);
  26. nv_pair->value = NULL;
  27. }