Skip to content

Commit

Permalink
Use static declaration for array sizes to uuid functions
Browse files Browse the repository at this point in the history
  • Loading branch information
AreaZR committed Aug 13, 2024
1 parent f96e6d1 commit fe22274
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions include/sudo_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,9 @@ sudo_dso_public void sudo_get_ttysize_v2(int fd, int *rowp, int *colp);
#define sudo_get_ttysize(_a, _b, _c) sudo_get_ttysize_v2((_a), (_b), (_c))

/* uuid.c */
sudo_dso_public void sudo_uuid_create_v1(unsigned char uuid_out[16]);
sudo_dso_public void sudo_uuid_create_v1(unsigned char uuid_out[restrict static 16]);
#define sudo_uuid_create(_a) sudo_uuid_create_v1((_a))
sudo_dso_public char *sudo_uuid_to_string_v1(const unsigned char uuid[restrict 16], char * restrict dst, size_t dstsiz);
sudo_dso_public char *sudo_uuid_to_string_v1(const unsigned char uuid[restrict static 16], char * restrict dst, size_t dstsiz);
#define sudo_uuid_to_string(_a, _b, _c) sudo_uuid_to_string_v1((_a), (_b), (_c))

#endif /* SUDO_UTIL_H */
4 changes: 2 additions & 2 deletions lib/util/uuid.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct uuid {
* As per RFC 4122 section 4.4.
*/
void
sudo_uuid_create_v1(unsigned char uuid_out[16])
sudo_uuid_create_v1(unsigned char uuid_out[restrict static 16])
{
struct uuid uuid;

Expand All @@ -71,7 +71,7 @@ sudo_uuid_create_v1(unsigned char uuid_out[16])
* Format a uuid as a 36-byte string (plus one for the NUL).
*/
char *
sudo_uuid_to_string_v1(const unsigned char uuid[restrict 16], char * restrict dst, size_t dstsiz)
sudo_uuid_to_string_v1(const unsigned char uuid[restrict static 16], char * restrict dst, size_t dstsiz)
{
const char hex[] = "0123456789abcdef";
char *cp = dst;
Expand Down

0 comments on commit fe22274

Please sign in to comment.