summaryrefslogtreecommitdiff
path: root/src/ActionHook.c
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2019-07-07 19:44:32 -0400
committerThomas E. Dickey <dickey@invisible-island.net>2019-07-07 19:44:32 -0400
commitf962bf49b6607db00443a93001c227e1a4d18275 (patch)
treeb50044e636ec918e5219b43ae8b26dedccb9e588 /src/ActionHook.c
parent6370bd1f33c7d8219176a0a59e7937cbd06b6794 (diff)
indent'd like "x-indent.sh", but with a more complete set of typedefs - see
https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
Diffstat (limited to 'src/ActionHook.c')
-rw-r--r--src/ActionHook.c67
1 files changed, 30 insertions, 37 deletions
diff --git a/src/ActionHook.c b/src/ActionHook.c
index 3213f29..bb81929 100644
--- a/src/ActionHook.c
+++ b/src/ActionHook.c
@@ -1,5 +1,4 @@
-/*LINTLIBRARY*/
-
+ /*LINTLIBRARY*/
/***********************************************************
Copyright (c) 1993, Oracle and/or its affiliates. All rights reserved.
@@ -43,7 +42,6 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
-
/*
Copyright 1987, 1988, 1998 The Open Group
@@ -69,75 +67,70 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
-
/*
* Contains XtAppAddActionHook, XtRemoveActionHook
*/
-
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "IntrinsicI.h"
-
/*ARGSUSED*/
-static void FreeActionHookList(
- Widget widget _X_UNUSED,
- XtPointer closure, /* ActionHook* */
- XtPointer call_data _X_UNUSED)
+static void
+FreeActionHookList(Widget widget _X_UNUSED,
+ XtPointer closure, /* ActionHook* */
+ XtPointer call_data _X_UNUSED)
{
- ActionHook list = *(ActionHook*)closure;
+ ActionHook list = *(ActionHook *) closure;
+
while (list != NULL) {
- ActionHook next = list->next;
- XtFree( (XtPointer)list );
- list = next;
+ ActionHook next = list->next;
+
+ XtFree((XtPointer) list);
+ list = next;
}
}
-
-XtActionHookId XtAppAddActionHook(
- XtAppContext app,
- XtActionHookProc proc,
- XtPointer closure)
+XtActionHookId
+XtAppAddActionHook(XtAppContext app, XtActionHookProc proc, XtPointer closure)
{
ActionHook hook = XtNew(ActionHookRec);
+
LOCK_APP(app);
hook->next = app->action_hook_list;
hook->app = app;
hook->proc = proc;
hook->closure = closure;
if (app->action_hook_list == NULL) {
- _XtAddCallback( &app->destroy_callbacks,
- FreeActionHookList,
- (XtPointer)&app->action_hook_list
- );
+ _XtAddCallback(&app->destroy_callbacks,
+ FreeActionHookList, (XtPointer) & app->action_hook_list);
}
app->action_hook_list = hook;
UNLOCK_APP(app);
- return (XtActionHookId)hook;
+ return (XtActionHookId) hook;
}
-
-void XtRemoveActionHook(
- XtActionHookId id)
+void
+XtRemoveActionHook(XtActionHookId id)
{
- ActionHook *p, hook = (ActionHook)id;
+ ActionHook *p, hook = (ActionHook) id;
XtAppContext app = hook->app;
+
LOCK_APP(app);
for (p = &app->action_hook_list; p != NULL && *p != hook; p = &(*p)->next);
if (p) {
- *p = hook->next;
- XtFree( (XtPointer)hook );
- if (app->action_hook_list == NULL)
- _XtRemoveCallback(&app->destroy_callbacks, FreeActionHookList,
- (XtPointer) &app->action_hook_list);
+ *p = hook->next;
+ XtFree((XtPointer) hook);
+ if (app->action_hook_list == NULL)
+ _XtRemoveCallback(&app->destroy_callbacks, FreeActionHookList,
+ (XtPointer) & app->action_hook_list);
}
#ifdef DEBUG
else {
- XtAppWarningMsg(app, "badId", "xtRemoveActionHook", XtCXtToolkitError,
- "XtRemoveActionHook called with bad or old hook id",
- NULL, NULL);
+ XtAppWarningMsg(app, "badId", "xtRemoveActionHook", XtCXtToolkitError,
+ "XtRemoveActionHook called with bad or old hook id",
+ NULL, NULL);
}
#endif /*DEBUG*/
- UNLOCK_APP(app);
+ UNLOCK_APP(app);
}