diff --git a/bin/linux/fsnotifier b/bin/linux/fsnotifier index 1b92b43b713b..d00f8950e307 100755 Binary files a/bin/linux/fsnotifier and b/bin/linux/fsnotifier differ diff --git a/bin/linux/fsnotifier64 b/bin/linux/fsnotifier64 index fd9213a9cfdf..0955255a9c35 100755 Binary files a/bin/linux/fsnotifier64 and b/bin/linux/fsnotifier64 differ diff --git a/native/fsNotifier/linux/fsnotifier.h b/native/fsNotifier/linux/fsnotifier.h index 087246e98644..e228aa8dca3f 100644 --- a/native/fsNotifier/linux/fsnotifier.h +++ b/native/fsNotifier/linux/fsnotifier.h @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,8 +14,9 @@ * limitations under the License. */ -#ifndef __FSNOTIFIER_H -#define __FSNOTIFIER_H +#pragma once + +#define VERSION "20160218.1348" #include #include @@ -82,6 +83,3 @@ char* read_line(FILE* stream); // path comparison bool is_parent_path(const char* parent_path, const char* child_path); - - -#endif diff --git a/native/fsNotifier/linux/inotify.c b/native/fsNotifier/linux/inotify.c index dee299cdab7a..50b06de91b1c 100644 --- a/native/fsNotifier/linux/inotify.c +++ b/native/fsNotifier/linux/inotify.c @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ #include #include -#include +#include #include #include #include @@ -27,9 +27,9 @@ #include #include -#if defined __i386__ +#if defined(__i386__) __asm__(".symver memcpy,memcpy@GLIBC_2.0"); -#elif defined __amd64__ +#elif defined(__amd64__) __asm__(".symver memcpy,memcpy@GLIBC_2.2.5"); #endif @@ -43,7 +43,7 @@ typedef struct __watch_node { struct __watch_node* parent; array* kids; int path_len; - char path[0]; + char path[]; } watch_node; static int inotify_fd = -1; @@ -112,12 +112,12 @@ static void read_watch_descriptors_count() { } -inline void set_inotify_callback(void (* _callback)(const char*, int)) { +void set_inotify_callback(void (* _callback)(const char*, int)) { callback = _callback; } -inline int get_inotify_fd() { +int get_inotify_fd() { return inotify_fd; } diff --git a/native/fsNotifier/linux/main.c b/native/fsNotifier/linux/main.c index b37a7f9e0c82..26d9f3795970 100644 --- a/native/fsNotifier/linux/main.c +++ b/native/fsNotifier/linux/main.c @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,8 +36,6 @@ #define LOG_ENV_ERROR "error" #define LOG_ENV_OFF "off" -#define VERSION "20130715.1353" -#define VERSION_MSG "fsnotifier " VERSION "\n" #define USAGE_MSG \ "fsnotifier - IntelliJ IDEA companion program for watching and reporting file and directory structure modifications.\n\n" \ @@ -93,7 +91,7 @@ int main(int argc, char** argv) { return 0; } else if (strcmp(argv[1], "--version") == 0) { - printf(VERSION_MSG); + printf("fsnotifier " VERSION "\n"); return 0; } else if (strcmp(argv[1], "--selftest") == 0) { diff --git a/native/fsNotifier/linux/make.sh b/native/fsNotifier/linux/make.sh index 549c62bed930..4aae5a0ced88 100755 --- a/native/fsNotifier/linux/make.sh +++ b/native/fsNotifier/linux/make.sh @@ -1,6 +1,9 @@ #!/bin/sh -CC_FLAGS="-O3 -Wall -std=c99 -D_DEFAULT_SOURCE" +CC_FLAGS="-O2 -Wall -Wextra -Wpedantic -std=c11 -D_DEFAULT_SOURCE" + +VER=$(date "+%Y%m%d.%H%M") +sed -i.bak "s/#define VERSION .*/#define VERSION \"${VER}\"/" fsnotifier.h && rm fsnotifier.h.bak if [ -f "/usr/include/gnu/stubs-32.h" ] ; then echo "compiling 32-bit version" diff --git a/native/fsNotifier/linux/util.c b/native/fsNotifier/linux/util.c index 854a48c7da6f..0f07080f1dc7 100644 --- a/native/fsNotifier/linux/util.c +++ b/native/fsNotifier/linux/util.c @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,12 +43,12 @@ static bool array_realloc(array* a) { } array* array_create(int initial_capacity) { - array* a = (array*) malloc(sizeof(array)); + array* a = calloc(1, sizeof(array)); if (a == NULL) { return NULL; } - a->data = calloc(sizeof(void*), initial_capacity); + a->data = calloc(initial_capacity, sizeof(void*)); if (a->data == NULL) { free(a); return NULL; @@ -131,17 +131,16 @@ struct __table { }; table* table_create(int capacity) { - table* t = malloc(sizeof(table)); + table* t = calloc(1, sizeof(table)); if (t == NULL) { return NULL; } - t->data = calloc(sizeof(void*), capacity); + t->data = calloc(capacity, sizeof(void*)); if (t->data == NULL) { free(t); return NULL; } - memset(t->data, 0, sizeof(void*) * capacity); t->capacity = capacity;