Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define snewn(n, type) ((type *)snmalloc((n), sizeof(type)))
- void bareradioline(struct ctlpos *cp, int nacross, ...)
- {
- va_list ap;
- struct radio *buttons;
- int i, nbuttons;
- va_start(ap, nacross);
- nbuttons = 0;
- while (1) {
- char *btext = va_arg(ap, char *);
- int bid;
- if (!btext)
- break;
- bid = va_arg(ap, int);
- }
- va_end(ap);
- buttons = snewn(nbuttons, struct radio);
- va_start(ap, nacross);
- for (i = 0; i < nbuttons; i++) {
- buttons[i].text = va_arg(ap, char *);
- buttons[i].id = va_arg(ap, int);
- }
- ....
- }
- When operator for(;; ) begin work, the 'nbuttons' variable still equal zero.
- This suspicious code was found in Putty project by PVS-Studio static code analyzer.
- Warning message is:
- V621 Consider inspecting the 'for' operator. It's possible that the loop will be executed incorrectly or won't be executed at all. winctrls.c 310
- PVS-Studio is a static analyzer for detecting bugs in the source code of applications written in C, C++, C++11, C++/CX. Site: http://www.viva64.com/en/pvs-studio/
Advertisement
Add Comment
Please, Sign In to add comment