Hi, I couldn't produce a right cocci file for my use. My goal is to replace a wrong sprintf call with a right one. So I wrote a cocci file like:
@@ identifier pBuf;@@ ( sprintf(pBuf+strlen(pBuf), "%s\n", PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name); | - sprintf(pBuf, "%s%s\n", pBuf, PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name); + sprintf(pBuf+strlen(pBuf), "%s\n", PRTMP_PRIVATE_STA_SHOW_CFG_VALUE_PROC->name); ) However, after I spatched the cocci file, nothing happened. No errors and no warnings. I checked the source file ( http://lxr.linux.no/#linux+v2.6.29/drivers/staging/rt2860/common/cmm_info.c) and found that the pBuf is defined as type "IN PUCHAR". I realized that it's not a kind of "identifier". But how should I write the cocci file? Could you help me? Thanks, Chen
_______________________________________________ Cocci mailing list [email protected] http://lists.diku.dk/mailman/listinfo/cocci (Web access from inside DIKUs LAN only)
