[Git][NTPsec/ntpsec][master] 3 commits: ntp_endian: Add some attribute((pure))

Gary E. Miller gitlab at mg.gitlab.com
Fri Apr 14 22:21:06 UTC 2017


Gary E. Miller pushed to branch master at NTPsec / ntpsec


Commits:
d69c7e81 by Gary E. Miller at 2017-04-14T15:20:23-07:00
ntp_endian: Add some attribute((pure))

- - - - -
8a0c6954 by Gary E. Miller at 2017-04-14T15:20:23-07:00
recvbuff: comment that gcc mistakenly thinks functions are pure.

- - - - -
ce6249ec by Gary E. Miller at 2017-04-14T15:20:23-07:00
sock_hash(): add attribute((pure))

- - - - -


3 changed files:

- include/ntp_endian.h
- include/ntp_stdlib.h
- include/recvbuff.h


Changes:

=====================================
include/ntp_endian.h
=====================================
--- a/include/ntp_endian.h
+++ b/include/ntp_endian.h
@@ -11,11 +11,11 @@
 
 #include <stdint.h>
 
-uint16_t ntp_be16dec(const void *buf);
+uint16_t ntp_be16dec(const void *buf) __attribute__((pure));
 void ntp_be16enc(void *buf, uint16_t x);
-uint32_t ntp_be32dec(const void *buf);
+uint32_t ntp_be32dec(const void *buf) __attribute__((pure));
 void ntp_be32enc(void *buf, uint32_t x);
-uint64_t ntp_be64dec(const void *buf);
+uint64_t ntp_be64dec(const void *buf) __attribute__((pure));
 void ntp_be64enc(void *buf, uint64_t x);
 
 #endif


=====================================
include/ntp_stdlib.h
=====================================
--- a/include/ntp_stdlib.h
+++ b/include/ntp_stdlib.h
@@ -130,7 +130,7 @@ extern	sockaddr_u * netof	(sockaddr_u *);
 extern	char *	numtoa		(uint32_t);
 extern	const char * socktoa	(const sockaddr_u *);
 extern	const char * sockporttoa(const sockaddr_u *);
-extern	unsigned short	sock_hash	(const sockaddr_u *);
+extern	unsigned short	sock_hash(const sockaddr_u *) __attribute__((pure));
 extern	int	sockaddr_masktoprefixlen(const sockaddr_u *);
 extern	bool	octtoint	(const char *, unsigned long *);
 extern	unsigned long	ranp2		(int);


=====================================
include/recvbuff.h
=====================================
--- a/include/recvbuff.h
+++ b/include/recvbuff.h
@@ -60,7 +60,7 @@ struct recvbuf {
 #endif /* REFCLOCK */
 };
 
-extern	void	init_recvbuff(u_int);
+extern	void	init_recvbuff(u_int); /* not really pure */
 
 /* freerecvbuf - make a single recvbuf available for reuse
  */
@@ -83,10 +83,10 @@ extern	struct recvbuf *get_free_recv_buffer_alloc(void);
 extern	void	add_full_recv_buffer(struct recvbuf *);
 
 /* number of recvbufs on freelist */
-extern u_long free_recvbuffs(void);		
-extern u_long full_recvbuffs(void);		
-extern u_long total_recvbuffs(void);
-extern u_long lowater_additions(void);
+extern u_long free_recvbuffs(void);    /* not really pure */
+extern u_long full_recvbuffs(void);    /* not really pure */
+extern u_long total_recvbuffs(void);   /* not really pure */
+extern u_long lowater_additions(void); /* not really pure */
 		
 /*  Returns the next buffer in the full list.
  *
@@ -102,6 +102,6 @@ extern	void purge_recv_buffers_for_fd(SOCKET);
 /*
  * Checks to see if there are buffers to process
  */
-extern bool has_full_recv_buffer(void);
+extern bool has_full_recv_buffer(void); /* not really pure */
 
 #endif	/* GUARD_RECVBUFF_H */



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/c77b2593e382664de948d040ee719ccc554c9551...ce6249ec256ffce3d7831046dcdc10702d396bc9

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/c77b2593e382664de948d040ee719ccc554c9551...ce6249ec256ffce3d7831046dcdc10702d396bc9
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170414/adc6cb60/attachment.html>


More information about the vc mailing list