1 Star 0 Fork 12

靳智敏/ipmitool

forked from src-openEuler/ipmitool 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Refactor-free_n-function.patch 1.21 KB
一键复制 编辑 原始数据 按行查看 历史
hexiaowen 提交于 2019-09-30 10:53 . Package init
From 08348f1b72de27681549894f7a506674fba19ff2 Mon Sep 17 00:00:00 2001
From: Alexander Amelkin <alexander@amelkin.msk.ru>
Date: Wed, 20 Feb 2019 14:56:37 +0300
Subject: [PATCH 114/119] Refactor free_n() function
Make the argument to free_n() compatible with any pointers,
thus reducing the number of compilation warnings.
End-user-impact: None
Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
---
include/ipmitool/helper.h | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/include/ipmitool/helper.h b/include/ipmitool/helper.h
index c03c931..0d4f6e3 100644
--- a/include/ipmitool/helper.h
+++ b/include/ipmitool/helper.h
@@ -37,6 +37,7 @@
#include <inttypes.h>
#include <stdio.h>
#include <string.h>
+#include <stdlib.h> /* For free() */
#ifndef TRUE
#define TRUE 1
@@ -115,10 +116,11 @@ uint16_t ipmi_get_oem_id(struct ipmi_intf *intf);
* Free the memory and clear the pointer.
* @param[in] ptr - a pointer to your pointer to free.
*/
-static inline void free_n(void **ptr) {
- if (ptr && *ptr) {
- free(*ptr);
- *ptr = NULL;
+static inline void free_n(void *ptr) {
+ void **pptr = (void **)ptr;
+ if (pptr && *pptr) {
+ free(*pptr);
+ *pptr = NULL;
}
}
--
2.19.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/jinzhimin369/ipmitool.git
git@gitee.com:jinzhimin369/ipmitool.git
jinzhimin369
ipmitool
ipmitool
master

搜索帮助