Commit d06a3eeaa37a1e2a0eb07a17ca830c9d483e85dc

Authored by Stéphane Raimbault
1 parent 13e1e8e2

Avoid to use reserved identifiers for header names (closes #157)

https://www.securecoding.cert.org/confluence/display/seccode/DCL37-C.+Do+not+declare+or+define+a+reserved+identifier
Not applied to libmodbus constants for now...
src/modbus-private.h
@@ -16,8 +16,8 @@ @@ -16,8 +16,8 @@
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */ 17 */
18 18
19 -#ifndef _MODBUS_PRIVATE_H_  
20 -#define _MODBUS_PRIVATE_H_ 19 +#ifndef MODBUS_PRIVATE_H
  20 +#define MODBUS_PRIVATE_H
21 21
22 #ifndef _MSC_VER 22 #ifndef _MSC_VER
23 # include <stdint.h> 23 # include <stdint.h>
@@ -124,4 +124,4 @@ size_t strlcpy(char *dest, const char *src, size_t dest_size); @@ -124,4 +124,4 @@ size_t strlcpy(char *dest, const char *src, size_t dest_size);
124 124
125 MODBUS_END_DECLS 125 MODBUS_END_DECLS
126 126
127 -#endif /* _MODBUS_PRIVATE_H_ */ 127 +#endif /* MODBUS_PRIVATE_H */
src/modbus-rtu-private.h
@@ -16,8 +16,8 @@ @@ -16,8 +16,8 @@
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */ 17 */
18 18
19 -#ifndef _MODBUS_RTU_PRIVATE_H_  
20 -#define _MODBUS_RTU_PRIVATE_H_ 19 +#ifndef MODBUS_RTU_PRIVATE_H
  20 +#define MODBUS_RTU_PRIVATE_H
21 21
22 #ifndef _MSC_VER 22 #ifndef _MSC_VER
23 #include <stdint.h> 23 #include <stdint.h>
@@ -87,4 +87,4 @@ typedef struct _modbus_rtu { @@ -87,4 +87,4 @@ typedef struct _modbus_rtu {
87 int confirmation_to_ignore; 87 int confirmation_to_ignore;
88 } modbus_rtu_t; 88 } modbus_rtu_t;
89 89
90 -#endif /* _MODBUS_RTU_PRIVATE_H_ */ 90 +#endif /* MODBUS_RTU_PRIVATE_H */
src/modbus-rtu.h
@@ -16,8 +16,8 @@ @@ -16,8 +16,8 @@
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */ 17 */
18 18
19 -#ifndef _MODBUS_RTU_H_  
20 -#define _MODBUS_RTU_H_ 19 +#ifndef MODBUS_RTU_H
  20 +#define MODBUS_RTU_H
21 21
22 #include "modbus.h" 22 #include "modbus.h"
23 23
@@ -46,4 +46,4 @@ MODBUS_API int modbus_rtu_get_rts(modbus_t *ctx); @@ -46,4 +46,4 @@ MODBUS_API int modbus_rtu_get_rts(modbus_t *ctx);
46 46
47 MODBUS_END_DECLS 47 MODBUS_END_DECLS
48 48
49 -#endif /* _MODBUS_RTU_H_ */ 49 +#endif /* MODBUS_RTU_H */
src/modbus-tcp-private.h
@@ -16,8 +16,8 @@ @@ -16,8 +16,8 @@
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */ 17 */
18 18
19 -#ifndef _MODBUS_TCP_PRIVATE_H_  
20 -#define _MODBUS_TCP_PRIVATE_H_ 19 +#ifndef MODBUS_TCP_PRIVATE_H
  20 +#define MODBUS_TCP_PRIVATE_H
21 21
22 #define _MODBUS_TCP_HEADER_LENGTH 7 22 #define _MODBUS_TCP_HEADER_LENGTH 7
23 #define _MODBUS_TCP_PRESET_REQ_LENGTH 12 23 #define _MODBUS_TCP_PRESET_REQ_LENGTH 12
@@ -53,4 +53,4 @@ typedef struct _modbus_tcp_pi { @@ -53,4 +53,4 @@ typedef struct _modbus_tcp_pi {
53 char service[_MODBUS_TCP_PI_SERVICE_LENGTH]; 53 char service[_MODBUS_TCP_PI_SERVICE_LENGTH];
54 } modbus_tcp_pi_t; 54 } modbus_tcp_pi_t;
55 55
56 -#endif /* _MODBUS_TCP_PRIVATE_H_ */ 56 +#endif /* MODBUS_TCP_PRIVATE_H */
src/modbus-tcp.h
@@ -16,8 +16,8 @@ @@ -16,8 +16,8 @@
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */ 17 */
18 18
19 -#ifndef _MODBUS_TCP_H_  
20 -#define _MODBUS_TCP_H_ 19 +#ifndef MODBUS_TCP_H
  20 +#define MODBUS_TCP_H
21 21
22 #include "modbus.h" 22 #include "modbus.h"
23 23
@@ -61,4 +61,4 @@ MODBUS_API int modbus_tcp_pi_accept(modbus_t *ctx, int *s); @@ -61,4 +61,4 @@ MODBUS_API int modbus_tcp_pi_accept(modbus_t *ctx, int *s);
61 61
62 MODBUS_END_DECLS 62 MODBUS_END_DECLS
63 63
64 -#endif /* _MODBUS_TCP_H_ */ 64 +#endif /* MODBUS_TCP_H */
src/modbus-version.h.in
@@ -15,8 +15,8 @@ @@ -15,8 +15,8 @@
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 -#ifndef _MODBUS_VERSION_H_  
19 -#define _MODBUS_VERSION_H_ 18 +#ifndef MODBUS_VERSION_H
  19 +#define MODBUS_VERSION_H
20 20
21 /* The major version, (1, if %LIBMODBUS_VERSION is 1.2.3) */ 21 /* The major version, (1, if %LIBMODBUS_VERSION is 1.2.3) */
22 #define LIBMODBUS_VERSION_MAJOR (@LIBMODBUS_VERSION_MAJOR@) 22 #define LIBMODBUS_VERSION_MAJOR (@LIBMODBUS_VERSION_MAJOR@)
@@ -49,4 +49,4 @@ @@ -49,4 +49,4 @@
49 LIBMODBUS_VERSION_MINOR == (minor) && \ 49 LIBMODBUS_VERSION_MINOR == (minor) && \
50 LIBMODBUS_VERSION_MICRO >= (micro))) 50 LIBMODBUS_VERSION_MICRO >= (micro)))
51 51
52 -#endif /* _MODBUS_VERSION_H_ */ 52 +#endif /* MODBUS_VERSION_H */
src/modbus.h
@@ -16,8 +16,8 @@ @@ -16,8 +16,8 @@
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */ 17 */
18 18
19 -#ifndef _MODBUS_H_  
20 -#define _MODBUS_H_ 19 +#ifndef MODBUS_H
  20 +#define MODBUS_H
21 21
22 /* Add this for macros that defined unix flavor */ 22 /* Add this for macros that defined unix flavor */
23 #if (defined(__unix__) || defined(unix)) && !defined(USG) 23 #if (defined(__unix__) || defined(unix)) && !defined(USG)
@@ -248,4 +248,4 @@ MODBUS_API void modbus_set_float_dcba(float f, uint16_t *dest); @@ -248,4 +248,4 @@ MODBUS_API void modbus_set_float_dcba(float f, uint16_t *dest);
248 248
249 MODBUS_END_DECLS 249 MODBUS_END_DECLS
250 250
251 -#endif /* _MODBUS_H_ */ 251 +#endif /* MODBUS_H */