如何替换所有出现的
check_free_set_to_null(&pointer)
通过
if (pointer)
{
free(pointer)
printf(pointer have been freed)
}
else
{
printf(pointer couldnt had been freed)
return (1)
}
可能使用某种
{1} = check_free_set_to_null(CONTENT)
if ({1})
{
free({1})
printf({1} have been freed)
}
else
{
printf({1} couldnt had been freed)
return (1)
}
我怎么能这样做? (请注意,它不完全是必须替换的,它只是一个例子) 我不是在寻找编译器将其解释为多行,我正在寻找修改文件。
答案 0 :(得分:1)
您可以将宏用于此作业。
#define check_free_set_to_null(pointer) if (pointer) { \
free(pointer)\
printf(pointer have been freed)\
} else {\
printf(pointer couldnt had been freed)\
return (1)\
}