diff options
author | sinanmohd <sinan@sinanmohd.com> | 2024-04-17 07:22:44 +0530 |
---|---|---|
committer | sinanmohd <sinan@sinanmohd.com> | 2024-04-17 07:30:00 +0530 |
commit | a6a49587035a29df9ad2401e47cffd9fb51e9ba3 (patch) | |
tree | cdf527ff893698ca75b42632dea4d73a9d52cadd /include | |
parent | cf70ac8af421dd9f1a53d9e5dbf89b976b02290b (diff) |
npass: refactor
https://www.kernel.org/doc/html/v4.10/process/coding-style.html
- Function return values and names
(-Exxx = failure, 0 = success) for imperative commands
(0 = failure, non-zero = success) for predicates
Diffstat (limited to 'include')
-rw-r--r-- | include/libnpass/libnpass.h | 2 | ||||
-rw-r--r-- | include/util.h | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/include/libnpass/libnpass.h b/include/libnpass/libnpass.h index 186b907..33e6831 100644 --- a/include/libnpass/libnpass.h +++ b/include/libnpass/libnpass.h @@ -30,5 +30,5 @@ int pass_cat(FILE *out, const char *path); int pass_add(const char *path, const char *pass, size_t n); int pass_rm(const char *path); -ssize_t pass_getpass(char **lineptr, size_t *n, FILE *stream); +ssize_t pass_getpass(char **lineptr, FILE *stream); int pass_gen(pass_gen_t gen, char *pass, int len); diff --git a/include/util.h b/include/util.h index 9c650e1..ca4e6d8 100644 --- a/include/util.h +++ b/include/util.h @@ -1,8 +1,10 @@ #include <stdio.h> +#define err_print(fmt, ...) \ + fprintf(stderr, "[%s:%d] " fmt "\n", __FILE__, __LINE__, ##__VA_ARGS__) + #define err_ret(r, fmt, ...) \ do { \ - fprintf(stderr, "[%s:%d] " fmt "\n", __FILE__, __LINE__, \ - ##__VA_ARGS__); \ + err_print(fmt, ##__VA_ARGS__); \ return r; \ } while (0) |