Просмотр исходного кода

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
Родитель
Сommit
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
-pkg_array_free(struct pkg_array *a)
+pkg_array_destroy(struct pkg_array *a)
 {
 	a->n_pkgs = 0;
 	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_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
 

+ 2 - 2
src/query.c

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

+ 1 - 1
src/select.c

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