mirror of
https://github.com/curl/curl.git
synced 2026-06-19 01:25:37 +03:00
tidy-up: drop stray comparisons with literal zero
Drop from: - strcmp, strcmpi, strncmp, memcmp, lstat, getrlimit, setrlimit, fseek, fstat - autotools detection snippets. - smooth-gtk-thread: simplify `!var != 0` expression. Closes #21947
This commit is contained in:
parent
2f3fa479dd
commit
97aed9c960
43 changed files with 142 additions and 143 deletions
|
|
@ -109,7 +109,7 @@ int main(int argc, const char **argv)
|
|||
if(!fp)
|
||||
return 2;
|
||||
|
||||
if(fstat(fileno(fp), &file_info) != 0) {
|
||||
if(fstat(fileno(fp), &file_info)) {
|
||||
fclose(fp);
|
||||
return 1; /* cannot continue */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -412,7 +412,7 @@ static int init_fifo(struct GlobalInfo *g)
|
|||
struct epoll_event epev;
|
||||
|
||||
fprintf(MSG_OUT, "Creating named pipe \"%s\"\n", fifo);
|
||||
if(lstat(fifo, &st) == 0) {
|
||||
if(!lstat(fifo, &st)) {
|
||||
if((st.st_mode & S_IFMT) == S_IFREG) {
|
||||
errno = EEXIST;
|
||||
perror("lstat");
|
||||
|
|
|
|||
|
|
@ -382,7 +382,7 @@ static int init_fifo(struct GlobalInfo *g)
|
|||
curl_socket_t sockfd;
|
||||
|
||||
fprintf(MSG_OUT, "Creating named pipe \"%s\"\n", fifo);
|
||||
if(lstat(fifo, &st) == 0) {
|
||||
if(!lstat(fifo, &st)) {
|
||||
if((st.st_mode & S_IFMT) == S_IFREG) {
|
||||
errno = EEXIST;
|
||||
perror("lstat");
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ int main(void)
|
|||
}
|
||||
|
||||
/* to get the file size */
|
||||
if(fstat(fileno(fd), &file_info) != 0) {
|
||||
if(fstat(fileno(fd), &file_info)) {
|
||||
fclose(fd);
|
||||
curl_global_cleanup();
|
||||
return 1; /* cannot continue */
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ int main(void)
|
|||
}
|
||||
|
||||
/* to get the file size */
|
||||
if(fstat(fileno(hd_src), &file_info) != 0) {
|
||||
if(fstat(fileno(hd_src), &file_info)) {
|
||||
fclose(hd_src);
|
||||
return 1; /* cannot continue */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -399,7 +399,7 @@ int init_fifo(void)
|
|||
const char *fifo = "hiper.fifo";
|
||||
int socket;
|
||||
|
||||
if(lstat(fifo, &st) == 0) {
|
||||
if(!lstat(fifo, &st)) {
|
||||
if((st.st_mode & S_IFMT) == S_IFREG) {
|
||||
errno = EEXIST;
|
||||
perror("lstat");
|
||||
|
|
|
|||
|
|
@ -383,7 +383,7 @@ static int init_fifo(struct GlobalInfo *g)
|
|||
curl_socket_t sockfd;
|
||||
|
||||
fprintf(MSG_OUT, "Creating named pipe \"%s\"\n", fifo);
|
||||
if(lstat(fifo, &st) == 0) {
|
||||
if(!lstat(fifo, &st)) {
|
||||
if((st.st_mode & S_IFMT) == S_IFREG) {
|
||||
errno = EEXIST;
|
||||
perror("lstat");
|
||||
|
|
|
|||
|
|
@ -234,7 +234,7 @@ static int setup(struct input *t, int num, const char *upload)
|
|||
return 1;
|
||||
}
|
||||
|
||||
if(fstat(fileno(t->in), &file_info) != 0) {
|
||||
if(fstat(fileno(t->in), &file_info)) {
|
||||
fprintf(stderr, "error: could not stat file %s: %s\n", upload,
|
||||
strerror(errno));
|
||||
fclose(t->out);
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ int main(int argc, const char **argv)
|
|||
return 2;
|
||||
|
||||
/* get the file size of the local file */
|
||||
if(fstat(fileno(hd_src), &file_info) != 0) {
|
||||
if(fstat(fileno(hd_src), &file_info)) {
|
||||
fclose(hd_src);
|
||||
return 1; /* cannot continue */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ int main(int argc, const char **argv)
|
|||
g_signal_connect(G_OBJECT(top_window), "delete-event",
|
||||
G_CALLBACK(cb_delete), NULL);
|
||||
|
||||
if(!g_thread_create(&create_thread, progress_bar, FALSE, NULL) != 0)
|
||||
if(!g_thread_create(&create_thread, progress_bar, FALSE, NULL))
|
||||
g_warning("cannot create the thread");
|
||||
|
||||
gtk_main();
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ static size_t SyncTime_CURL_WriteHeader(void *ptr, size_t size, size_t nmemb,
|
|||
int i;
|
||||
SYSTime.wMilliseconds = 500; /* adjust to midpoint, 0.5 sec */
|
||||
for(i = 0; i < 12; i++) {
|
||||
if(strcmp(MthStr[i], TmpStr2) == 0) {
|
||||
if(!strcmp(MthStr[i], TmpStr2)) {
|
||||
SYSTime.wMonth = (WORD)(i + 1);
|
||||
break;
|
||||
}
|
||||
|
|
@ -232,26 +232,26 @@ int main(int argc, const char *argv[])
|
|||
if(argc > 1) {
|
||||
int OptionIndex = 1;
|
||||
while(OptionIndex < argc) {
|
||||
if(strncmp(argv[OptionIndex], "--server=", 9) == 0)
|
||||
if(!strncmp(argv[OptionIndex], "--server=", 9))
|
||||
snprintf(conf.timeserver, sizeof(conf.timeserver) - 1, "%s",
|
||||
&argv[OptionIndex][9]);
|
||||
|
||||
if(strcmp(argv[OptionIndex], "--showall") == 0)
|
||||
if(!strcmp(argv[OptionIndex], "--showall"))
|
||||
ShowAllHeader = 1;
|
||||
|
||||
if(strcmp(argv[OptionIndex], "--synctime") == 0)
|
||||
if(!strcmp(argv[OptionIndex], "--synctime"))
|
||||
AutoSyncTime = 1;
|
||||
|
||||
if(strncmp(argv[OptionIndex], "--proxy-user=", 13) == 0)
|
||||
if(!strncmp(argv[OptionIndex], "--proxy-user=", 13))
|
||||
snprintf(conf.proxy_user, sizeof(conf.proxy_user) - 1, "%s",
|
||||
&argv[OptionIndex][13]);
|
||||
|
||||
if(strncmp(argv[OptionIndex], "--proxy=", 8) == 0)
|
||||
if(!strncmp(argv[OptionIndex], "--proxy=", 8))
|
||||
snprintf(conf.http_proxy, sizeof(conf.http_proxy) - 1, "%s",
|
||||
&argv[OptionIndex][8]);
|
||||
|
||||
if((strcmp(argv[OptionIndex], "--help") == 0) ||
|
||||
(strcmp(argv[OptionIndex], "/?") == 0)) {
|
||||
if(!strcmp(argv[OptionIndex], "--help") ||
|
||||
!strcmp(argv[OptionIndex], "/?")) {
|
||||
showUsage();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue