Skip to content

Commit

Permalink
utils: make N_ELEMENTS public
Browse files Browse the repository at this point in the history
The calculation of the size of an array is used in the main code as
well, so it makes sense to move N_ELEMENTS to a common header to use it
more often.

Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
  • Loading branch information
sumit-bose authored and jhrozek committed Feb 16, 2019
1 parent d409df3 commit e32920a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/tests/common.h
Expand Up @@ -39,8 +39,6 @@
#define SSS_ATTRIBUTE_WARN_UNUSED_RESULT
#endif

#define N_ELEMENTS(arr) (sizeof(arr) / sizeof(arr[0]))

extern TALLOC_CTX *global_talloc_context;

void check_leaks_push(TALLOC_CTX *ctx);
Expand Down
4 changes: 4 additions & 0 deletions src/util/util.h
Expand Up @@ -726,4 +726,8 @@ errno_t create_preauth_indicator(void);
#define P11_WAIT_FOR_CARD_TIMEOUT_DEFAULT 60
#endif /* SSSD_LIBEXEC_PATH */

#ifndef N_ELEMENTS
#define N_ELEMENTS(arr) (sizeof(arr) / sizeof(arr[0]))
#endif

#endif /* __SSSD_UTIL_H__ */

0 comments on commit e32920a

Please sign in to comment.