@@ -75,21 +75,22 @@ static unsigned int countParameters(const Token *tok)
7575 * This list contains function names with const parameters e.g.: atof(const char *)
7676 * TODO: This list should be replaced by <leak-ignore/> in .cfg files.
7777 */
78- static const std::set<std::string> call_func_white_list = make_container < std::set<std::string> > ()
79- << " _open" << " _wopen" << " access" << " adjtime" << " asctime_r" << " asprintf" << " chdir" << " chmod" << " chown"
80- << " creat" << " ctime_r" << " execl" << " execle" << " execlp" << " execv" << " execve" << " fchmod" << " fcntl"
81- << " fdatasync" << " fclose" << " flock" << " fmemopen" << " fnmatch" << " fopen" << " fopencookie" << " for" << " free"
82- << " freopen" << " fseeko" << " fstat" << " fsync" << " ftello" << " ftruncate" << " getgrnam" << " gethostbyaddr" << " gethostbyname"
83- << " getnetbyname" << " getopt" << " getopt_long" << " getprotobyname" << " getpwnam" << " getservbyname" << " getservbyport"
84- << " glob" << " gmtime" << " gmtime_r" << " if" << " index" << " inet_addr" << " inet_aton" << " inet_network" << " initgroups"
85- << " ioctl" << " link" << " localtime_r" << " lockf" << " lseek" << " lstat" << " mkdir" << " mkfifo" << " mknod" << " mkstemp"
86- << " obstack_printf" << " obstack_vprintf" << " open" << " opendir" << " parse_printf_format" << " pathconf"
87- << " perror" << " popen" << " posix_fadvise" << " posix_fallocate" << " pread" << " psignal" << " pwrite" << " read" << " readahead"
88- << " readdir" << " readdir_r" << " readlink" << " readv" << " realloc" << " regcomp" << " return" << " rewinddir" << " rindex"
89- << " rmdir" << " scandir" << " seekdir" << " setbuffer" << " sethostname" << " setlinebuf" << " sizeof" << " strdup"
90- << " stat" << " stpcpy" << " strcasecmp" << " stricmp" << " strncasecmp" << " switch"
91- << " symlink" << " sync_file_range" << " telldir" << " tempnam" << " time" << " typeid" << " unlink"
92- << " utime" << " utimes" << " vasprintf" << " while" << " wordexp" << " write" << " writev" ;
78+ static const std::set<std::string> call_func_white_list = {
79+ " _open" , " _wopen" , " access" , " adjtime" , " asctime_r" , " asprintf" , " chdir" , " chmod" , " chown"
80+ , " creat" , " ctime_r" , " execl" , " execle" , " execlp" , " execv" , " execve" , " fchmod" , " fcntl"
81+ , " fdatasync" , " fclose" , " flock" , " fmemopen" , " fnmatch" , " fopen" , " fopencookie" , " for" , " free"
82+ , " freopen" , " fseeko" , " fstat" , " fsync" , " ftello" , " ftruncate" , " getgrnam" , " gethostbyaddr" , " gethostbyname"
83+ , " getnetbyname" , " getopt" , " getopt_long" , " getprotobyname" , " getpwnam" , " getservbyname" , " getservbyport"
84+ , " glob" , " gmtime" , " gmtime_r" , " if" , " index" , " inet_addr" , " inet_aton" , " inet_network" , " initgroups"
85+ , " ioctl" , " link" , " localtime_r" , " lockf" , " lseek" , " lstat" , " mkdir" , " mkfifo" , " mknod" , " mkstemp"
86+ , " obstack_printf" , " obstack_vprintf" , " open" , " opendir" , " parse_printf_format" , " pathconf"
87+ , " perror" , " popen" , " posix_fadvise" , " posix_fallocate" , " pread" , " psignal" , " pwrite" , " read" , " readahead"
88+ , " readdir" , " readdir_r" , " readlink" , " readv" , " realloc" , " regcomp" , " return" , " rewinddir" , " rindex"
89+ , " rmdir" , " scandir" , " seekdir" , " setbuffer" , " sethostname" , " setlinebuf" , " sizeof" , " strdup"
90+ , " stat" , " stpcpy" , " strcasecmp" , " stricmp" , " strncasecmp" , " switch"
91+ , " symlink" , " sync_file_range" , " telldir" , " tempnam" , " time" , " typeid" , " unlink"
92+ , " utime" , " utimes" , " vasprintf" , " while" , " wordexp" , " write" , " writev"
93+ };
9394
9495// ---------------------------------------------------------------------------
9596
@@ -506,18 +507,19 @@ bool CheckMemoryLeakInFunction::test_white_list(const std::string &funcname, con
506507}
507508
508509namespace {
509- const std::set<std::string> call_func_keywords = make_container < std::set<std::string> > ()
510- << " asprintf"
511- << " delete"
512- << " fclose"
513- << " for"
514- << " free"
515- << " if"
516- << " realloc"
517- << " return"
518- << " switch"
519- << " while"
520- << " sizeof" ;
510+ const std::set<std::string> call_func_keywords = {
511+ " asprintf"
512+ , " delete"
513+ , " fclose"
514+ , " for"
515+ , " free"
516+ , " if"
517+ , " realloc"
518+ , " return"
519+ , " switch"
520+ , " while"
521+ , " sizeof"
522+ };
521523}
522524
523525const char * CheckMemoryLeakInFunction::call_func (const Token *tok, std::list<const Token *> callstack, const unsigned int varid, AllocType &alloctype, AllocType &dealloctype, bool &allocpar, unsigned int sz)
0 commit comments