summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/plist/plist.h34
1 files changed, 20 insertions, 14 deletions
diff --git a/include/plist/plist.h b/include/plist/plist.h
index ab91612..67050ee 100644
--- a/include/plist/plist.h
+++ b/include/plist/plist.h
@@ -449,6 +449,7 @@ extern "C"
449 * @param node the node 449 * @param node the node
450 * @param val a pointer to a C-string. This function allocates the memory, 450 * @param val a pointer to a C-string. This function allocates the memory,
451 * caller is responsible for freeing it. 451 * caller is responsible for freeing it.
452 * @note Use plist_mem_free() to free the allocated memory.
452 */ 453 */
453 void plist_get_key_val(plist_t node, char **val); 454 void plist_get_key_val(plist_t node, char **val);
454 455
@@ -459,6 +460,7 @@ extern "C"
459 * @param node the node 460 * @param node the node
460 * @param val a pointer to a C-string. This function allocates the memory, 461 * @param val a pointer to a C-string. This function allocates the memory,
461 * caller is responsible for freeing it. Data is UTF-8 encoded. 462 * caller is responsible for freeing it. Data is UTF-8 encoded.
463 * @note Use plist_mem_free() to free the allocated memory.
462 */ 464 */
463 void plist_get_string_val(plist_t node, char **val); 465 void plist_get_string_val(plist_t node, char **val);
464 466
@@ -510,6 +512,7 @@ extern "C"
510 * @param val a pointer to an unallocated char buffer. This function allocates the memory, 512 * @param val a pointer to an unallocated char buffer. This function allocates the memory,
511 * caller is responsible for freeing it. 513 * caller is responsible for freeing it.
512 * @param length the length of the buffer 514 * @param length the length of the buffer
515 * @note Use plist_mem_free() to free the allocated memory.
513 */ 516 */
514 void plist_get_data_val(plist_t node, char **val, uint64_t * length); 517 void plist_get_data_val(plist_t node, char **val, uint64_t * length);
515 518
@@ -642,34 +645,22 @@ extern "C"
642 * @param plist_xml a pointer to a C-string. This function allocates the memory, 645 * @param plist_xml a pointer to a C-string. This function allocates the memory,
643 * caller is responsible for freeing it. Data is UTF-8 encoded. 646 * caller is responsible for freeing it. Data is UTF-8 encoded.
644 * @param length a pointer to an uint32_t variable. Represents the length of the allocated buffer. 647 * @param length a pointer to an uint32_t variable. Represents the length of the allocated buffer.
648 * @note Use plist_mem_free() to free the allocated memory.
645 */ 649 */
646 void plist_to_xml(plist_t plist, char **plist_xml, uint32_t * length); 650 void plist_to_xml(plist_t plist, char **plist_xml, uint32_t * length);
647 651
648 /** 652 /**
649 * Frees the memory allocated by plist_to_xml().
650 *
651 * @param plist_xml The buffer allocated by plist_to_xml().
652 */
653 void plist_to_xml_free(char *plist_xml);
654
655 /**
656 * Export the #plist_t structure to binary format. 653 * Export the #plist_t structure to binary format.
657 * 654 *
658 * @param plist the root node to export 655 * @param plist the root node to export
659 * @param plist_bin a pointer to a char* buffer. This function allocates the memory, 656 * @param plist_bin a pointer to a char* buffer. This function allocates the memory,
660 * caller is responsible for freeing it. 657 * caller is responsible for freeing it.
661 * @param length a pointer to an uint32_t variable. Represents the length of the allocated buffer. 658 * @param length a pointer to an uint32_t variable. Represents the length of the allocated buffer.
659 * @note Use plist_mem_free() to free the allocated memory.
662 */ 660 */
663 void plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length); 661 void plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length);
664 662
665 /** 663 /**
666 * Frees the memory allocated by plist_to_bin().
667 *
668 * @param plist_bin The buffer allocated by plist_to_bin().
669 */
670 void plist_to_bin_free(char *plist_bin);
671
672 /**
673 * Import the #plist_t structure from XML format. 664 * Import the #plist_t structure from XML format.
674 * 665 *
675 * @param plist_xml a pointer to the xml buffer. 666 * @param plist_xml a pointer to the xml buffer.
@@ -945,6 +936,21 @@ extern "C"
945 */ 936 */
946 int plist_data_val_contains(plist_t datanode, const uint8_t* cmpval, size_t n); 937 int plist_data_val_contains(plist_t datanode, const uint8_t* cmpval, size_t n);
947 938
939 /**
940 * Free memory allocated by relevant libplist API calls:
941 * - plist_to_xml()
942 * - plist_to_bin()
943 * - plist_get_key_val()
944 * - plist_get_string_val()
945 * - plist_get_data_val()
946 *
947 * @param ptr pointer to the memory to free
948 *
949 * @note Do not use this function to free plist_t nodes, use plist_free()
950 * instead.
951 */
952 void plist_mem_free(void* ptr);
953
948 /*@}*/ 954 /*@}*/
949 955
950#ifdef __cplusplus 956#ifdef __cplusplus