Staging
v0.5.1
https://github.com/git/git
Revision 53a06cf39b756eddfe4a2a34da93e3d04eb7b728 authored by Johannes Schindelin on 04 December 2019, 22:10:12 UTC, committed by Johannes Schindelin on 06 December 2019, 15:31:40 UTC
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 67af91c
Raw File
Tip revision: 53a06cf39b756eddfe4a2a34da93e3d04eb7b728 authored by Johannes Schindelin on 04 December 2019, 22:10:12 UTC
Git 2.24.1
Tip revision: 53a06cf
banned.h
#ifndef BANNED_H
#define BANNED_H

/*
 * This header lists functions that have been banned from our code base,
 * because they're too easy to misuse (and even if used correctly,
 * complicate audits). Including this header turns them into compile-time
 * errors.
 */

#define BANNED(func) sorry_##func##_is_a_banned_function

#undef strcpy
#define strcpy(x,y) BANNED(strcpy)
#undef strcat
#define strcat(x,y) BANNED(strcat)
#undef strncpy
#define strncpy(x,y,n) BANNED(strncpy)
#undef strncat
#define strncat(x,y,n) BANNED(strncat)

#undef sprintf
#undef vsprintf
#ifdef HAVE_VARIADIC_MACROS
#define sprintf(...) BANNED(sprintf)
#define vsprintf(...) BANNED(vsprintf)
#else
#define sprintf(buf,fmt,arg) BANNED(sprintf)
#define vsprintf(buf,fmt,arg) BANNED(vsprintf)
#endif

#endif /* BANNED_H */
back to top