소스 검색

libdpkg: Rename pkg_array_free to pkg_array_destroy

The convention is for functions named _free to deallocate the contents
and the given pointer, while this one only deallocates the contents, so
we rename it to make this distinction clear.
Guillem Jover 16 년 전
부모
커밋
c6520d6700
4개의 변경된 파일9개의 추가작업 그리고 7개의 파일을 삭제
  1. 5 3
      lib/dpkg/pkg-array.c
  2. 1 1
      lib/dpkg/pkg-array.h
  3. 2 2
      src/query.c
  4. 1 1
      src/select.c

+ 5 - 3
lib/dpkg/pkg-array.c

@@ -66,12 +66,14 @@ pkg_array_sort(struct pkg_array *a, pkg_sorter_func *pkg_sort)
 }
 }
 
 
 /**
 /**
- * Free a package array.
+ * Destroy a package array.
  *
  *
- * @param a The array to free.
+ * Frees the allocated memory and resets the members.
+ *
+ * @param a The array to destroy.
  */
  */
 void
 void
-pkg_array_free(struct pkg_array *a)
+pkg_array_destroy(struct pkg_array *a)
 {
 {
 	a->n_pkgs = 0;
 	a->n_pkgs = 0;
 	free(a->pkgs);
 	free(a->pkgs);

+ 1 - 1
lib/dpkg/pkg-array.h

@@ -39,7 +39,7 @@ struct pkg_array {
 
 
 void pkg_array_init_from_db(struct pkg_array *a);
 void pkg_array_init_from_db(struct pkg_array *a);
 void pkg_array_sort(struct pkg_array *a, pkg_sorter_func *pkg_sort);
 void pkg_array_sort(struct pkg_array *a, pkg_sorter_func *pkg_sort);
-void pkg_array_free(struct pkg_array *a);
+void pkg_array_destroy(struct pkg_array *a);
 
 
 DPKG_END_DECLS
 DPKG_END_DECLS
 
 

+ 2 - 2
src/query.c

@@ -183,7 +183,7 @@ void listpackages(const char *const *argv) {
   m_output(stdout, _("<standard output>"));
   m_output(stdout, _("<standard output>"));
   m_output(stderr, _("<standard error>"));
   m_output(stderr, _("<standard error>"));
 
 
-  pkg_array_free(&array);
+  pkg_array_destroy(&array);
   modstatdb_shutdown();
   modstatdb_shutdown();
 }
 }
 
 
@@ -432,7 +432,7 @@ void showpackages(const char *const *argv) {
   m_output(stdout, _("<standard output>"));
   m_output(stdout, _("<standard output>"));
   m_output(stderr, _("<standard error>"));
   m_output(stderr, _("<standard error>"));
 
 
-  pkg_array_free(&array);
+  pkg_array_destroy(&array);
   freeformat(fmt);
   freeformat(fmt);
   modstatdb_shutdown();
   modstatdb_shutdown();
 }
 }

+ 1 - 1
src/select.c

@@ -77,7 +77,7 @@ void getselections(const char *const *argv) {
   m_output(stdout, _("<standard output>"));
   m_output(stdout, _("<standard output>"));
   m_output(stderr, _("<standard error>"));
   m_output(stderr, _("<standard error>"));
 
 
-  pkg_array_free(&array);
+  pkg_array_destroy(&array);
 }
 }
 
 
 void setselections(const char *const *argv) {
 void setselections(const char *const *argv) {