diff options
author | kotontrion <[email protected]> | 2024-06-16 18:50:09 +0200 |
---|---|---|
committer | kotontrion <[email protected]> | 2024-06-16 18:50:09 +0200 |
commit | b35a38aa93670f6be06202f2ad3066a227f0a1b9 (patch) | |
tree | 1c51be4ed5c53202d11017508b5604b39db4ffef /examples | |
parent | 33b3b60ee513ce2d313ce31c292afc114a110eb3 (diff) |
fix code style
Diffstat (limited to 'examples')
-rw-r--r-- | examples/full_example.c | 7 | ||||
-rw-r--r-- | examples/simple_example.c | 11 |
2 files changed, 6 insertions, 12 deletions
diff --git a/examples/full_example.c b/examples/full_example.c index 844f423..73096a6 100644 --- a/examples/full_example.c +++ b/examples/full_example.c @@ -1,10 +1,11 @@ -#include "auth.h" #include <bsd/readpassphrase.h> +#include "auth.h" + GMainLoop *loop; static void authenticate(AstalAuthPam *pam) { - if(!astal_auth_pam_start_authenticate(pam)) { + if (!astal_auth_pam_start_authenticate(pam)) { g_print("could not start authentication process\n"); g_object_unref(pam); g_main_loop_quit(loop); @@ -44,9 +45,7 @@ static void on_fail(AstalAuthPam *pam, const gchar *data) { authenticate(pam); } - int main(void) { - GMainContext *loopctx = NULL; loop = g_main_loop_new(loopctx, FALSE); diff --git a/examples/simple_example.c b/examples/simple_example.c index 257c2fe..e11b5f9 100644 --- a/examples/simple_example.c +++ b/examples/simple_example.c @@ -1,11 +1,10 @@ #include <bsd/readpassphrase.h> + #include "auth.h" GMainLoop *loop; -void ready_callback(AstalAuthPam *pam, - GAsyncResult *res, - gpointer user_data) { +void ready_callback(AstalAuthPam *pam, GAsyncResult *res, gpointer user_data) { GError *error = NULL; astal_auth_pam_authenticate_finish(res, &error); if (error == NULL) { @@ -19,16 +18,12 @@ void ready_callback(AstalAuthPam *pam, } int main(void) { - GMainContext *loopctx = NULL; loop = g_main_loop_new(loopctx, FALSE); gchar *passbuf = calloc(1024, sizeof(gchar)); readpassphrase("Password: ", passbuf, 1024, RPP_ECHO_OFF); - astal_auth_pam_authenticate(passbuf, - (GAsyncReadyCallback) ready_callback, - NULL - ); + astal_auth_pam_authenticate(passbuf, (GAsyncReadyCallback)ready_callback, NULL); g_free(passbuf); g_main_loop_run(loop); |