summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2019-05-16 20:53:42 -0400
committerThomas E. Dickey <dickey@invisible-island.net>2019-05-18 06:42:03 -0400
commit1f0e3238352a497a59a36e0b8a5b4723c634b2e1 (patch)
treed49a598905cf10e28ff7d21a627e2f90a6e79ada
parentfb78a7c881adbe46f1f8c6e8e429bc8963c9b3e8 (diff)
fix most clang --analyze warnings about null-pointers
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
-rw-r--r--src/Composite.c38
-rw-r--r--src/Convert.c4
-rw-r--r--src/Converters.c9
-rw-r--r--src/Create.c3
-rw-r--r--src/Display.c29
-rw-r--r--src/Geometry.c25
-rw-r--r--src/ResConfig.c68
-rw-r--r--src/Resources.c136
-rw-r--r--src/SetValues.c18
-rw-r--r--src/TMparse.c70
-rw-r--r--src/TMstate.c3
-rw-r--r--src/Varargs.c76
12 files changed, 256 insertions, 223 deletions
diff --git a/src/Composite.c b/src/Composite.c
index 5188514..108645d 100644
--- a/src/Composite.c
+++ b/src/Composite.c
@@ -184,34 +184,32 @@ static void CompositeClassPartInitialize(
wcPtr = (CompositePartPtr)
&(((CompositeWidgetClass)myWidgetClass)->composite_class);
- if (myWidgetClass != compositeWidgetClass)
+ if (myWidgetClass != compositeWidgetClass) {
/* don't compute possible bogus pointer */
superPtr = (CompositePartPtr)&(((CompositeWidgetClass)myWidgetClass
->core_class.superclass)->composite_class);
- /* We don't need to check for null super since we'll get to composite
- eventually, and it had better define them! */
-
- LOCK_PROCESS;
- if (wcPtr->geometry_manager == XtInheritGeometryManager) {
- wcPtr->geometry_manager =
- superPtr->geometry_manager;
- }
+ LOCK_PROCESS;
+ if (wcPtr->geometry_manager == XtInheritGeometryManager) {
+ wcPtr->geometry_manager =
+ superPtr->geometry_manager;
+ }
- if (wcPtr->change_managed == XtInheritChangeManaged) {
- wcPtr->change_managed =
- superPtr->change_managed;
- InheritAllowsChangeManagedSet(myWidgetClass);
- }
+ if (wcPtr->change_managed == XtInheritChangeManaged) {
+ wcPtr->change_managed =
+ superPtr->change_managed;
+ InheritAllowsChangeManagedSet(myWidgetClass);
+ }
- if (wcPtr->insert_child == XtInheritInsertChild) {
- wcPtr->insert_child = superPtr->insert_child;
- }
+ if (wcPtr->insert_child == XtInheritInsertChild) {
+ wcPtr->insert_child = superPtr->insert_child;
+ }
- if (wcPtr->delete_child == XtInheritDeleteChild) {
- wcPtr->delete_child = superPtr->delete_child;
+ if (wcPtr->delete_child == XtInheritDeleteChild) {
+ wcPtr->delete_child = superPtr->delete_child;
+ }
+ UNLOCK_PROCESS;
}
- UNLOCK_PROCESS;
}
static void CompositeDestroy(
diff --git a/src/Convert.c b/src/Convert.c
index bd7ec2a..f9f241e 100644
--- a/src/Convert.c
+++ b/src/Convert.c
@@ -404,7 +404,7 @@ CacheEnter(
(void) memmove((char *)p->from.addr, (char *)from->addr, from->size);
}
p->num_args = (unsigned short) num_args;
- if (num_args) {
+ if (num_args && args) {
XrmValue *pargs = CARGS(p);
register Cardinal i;
for (i = 0; i < num_args; i++) {
@@ -453,7 +453,7 @@ static void FreeCacheRec(
*(CEXT(p)->prev) = p->next;
if (p->next && p->next->has_ext)
CEXT(p->next)->prev = CEXT(p)->prev;
- } else {
+ } else if (prev) {
*prev = p->next;
if (p->next && p->next->has_ext)
CEXT(p->next)->prev = prev;
diff --git a/src/Converters.c b/src/Converters.c
index 32e3641..bf91f1f 100644
--- a/src/Converters.c
+++ b/src/Converters.c
@@ -561,15 +561,16 @@ static void FetchDisplayArg(
Cardinal *size,
XrmValue* value)
{
- if (widget == NULL)
+ if (widget == NULL) {
XtErrorMsg("missingWidget", "fetchDisplayArg", XtCXtToolkitError,
"FetchDisplayArg called without a widget to reference",
NULL, NULL);
/* can't return any useful Display and caller will de-ref NULL,
so aborting is the only useful option */
-
- value->size = sizeof(Display*);
- value->addr = (XPointer)&DisplayOfScreen(XtScreenOfObject(widget));
+ } else {
+ value->size = sizeof(Display*);
+ value->addr = (XPointer)&DisplayOfScreen(XtScreenOfObject(widget));
+ }
}
static XtConvertArgRec const displayConvertArg[] = {
diff --git a/src/Create.c b/src/Create.c
index 8227e38..1d18590 100644
--- a/src/Create.c
+++ b/src/Create.c
@@ -270,6 +270,9 @@ xtWidgetAlloc(
Cardinal csize = 0;
ObjectClassExtension ext;
+ if (widget_class == NULL)
+ return 0;
+
LOCK_PROCESS;
if (! (widget_class->core_class.class_inited))
XtInitializeWidgetClass(widget_class);
diff --git a/src/Display.c b/src/Display.c
index 459bce7..e4cf87d 100644
--- a/src/Display.c
+++ b/src/Display.c
@@ -555,6 +555,7 @@ PerDisplayTablePtr _XtperDisplayList = NULL;
XtPerDisplay _XtSortPerDisplayList(Display *dpy)
{
register PerDisplayTablePtr pd, opd = NULL;
+ XtPerDisplay result = NULL;
LOCK_PROCESS;
for (pd = _XtperDisplayList;
@@ -567,17 +568,18 @@ XtPerDisplay _XtSortPerDisplayList(Display *dpy)
XtErrorMsg(XtNnoPerDisplay, "getPerDisplay", XtCXtToolkitError,
"Couldn't find per display information",
NULL, NULL);
- }
-
- if (pd != _XtperDisplayList) { /* move it to the front */
- /* opd points to the previous one... */
+ } else {
+ if (pd != _XtperDisplayList) { /* move it to the front */
+ /* opd points to the previous one... */
- opd->next = pd->next;
- pd->next = _XtperDisplayList;
- _XtperDisplayList = pd;
+ opd->next = pd->next;
+ pd->next = _XtperDisplayList;
+ _XtperDisplayList = pd;
+ }
+ result = &(pd->perDpy);
}
UNLOCK_PROCESS;
- return &(pd->perDpy);
+ return result;
}
XtAppContext XtDisplayToApplicationContext(Display *dpy)
@@ -590,7 +592,7 @@ XtAppContext XtDisplayToApplicationContext(Display *dpy)
static void CloseDisplay(Display *dpy)
{
- register XtPerDisplay xtpd;
+ register XtPerDisplay xtpd = NULL;
register PerDisplayTablePtr pd, opd = NULL;
XrmDatabase db;
@@ -607,12 +609,13 @@ static void CloseDisplay(Display *dpy)
XtErrorMsg(XtNnoPerDisplay, "closeDisplay", XtCXtToolkitError,
"Couldn't find per display information",
NULL, NULL);
- }
+ } else {
- if (pd == _XtperDisplayList) _XtperDisplayList = pd->next;
- else opd->next = pd->next;
+ if (pd == _XtperDisplayList) _XtperDisplayList = pd->next;
+ else opd->next = pd->next;
- xtpd = &(pd->perDpy);
+ xtpd = &(pd->perDpy);
+ }
if (xtpd != NULL) {
int i;
diff --git a/src/Geometry.c b/src/Geometry.c
index b8d3606..992141e 100644
--- a/src/Geometry.c
+++ b/src/Geometry.c
@@ -116,7 +116,9 @@ _XtMakeGeometryRequest (
XtGeometryHandler manager = (XtGeometryHandler) NULL;
XtGeometryResult returnCode;
Widget parent = widget->core.parent;
- Boolean managed, parentRealized, rgm = False;
+ Boolean managed;
+ Boolean parentRealized = False;
+ Boolean rgm = False;
XtConfigureHookDataRec req;
Widget hookobj;
@@ -163,21 +165,22 @@ _XtMakeGeometryRequest (
parentRealized = TRUE;
UNLOCK_PROCESS;
} else /* not shell */ {
- if (parent == NULL)
+ if (parent == NULL) {
XtAppErrorMsg(XtWidgetToApplicationContext(widget),
"invalidParent","xtMakeGeometryRequest",
XtCXtToolkitError,
"non-shell has no parent in XtMakeGeometryRequest",
NULL, NULL);
-
- managed = XtIsManaged(widget);
- parentRealized = XtIsRealized(parent);
- if (XtIsComposite(parent))
- {
- LOCK_PROCESS;
- manager = ((CompositeWidgetClass) (parent->core.widget_class))
- ->composite_class.geometry_manager;
- UNLOCK_PROCESS;
+ } else {
+ managed = XtIsManaged(widget);
+ parentRealized = XtIsRealized(parent);
+ if (XtIsComposite(parent))
+ {
+ LOCK_PROCESS;
+ manager = ((CompositeWidgetClass) (parent->core.widget_class))
+ ->composite_class.geometry_manager;
+ UNLOCK_PROCESS;
+ }
}
}
diff --git a/src/ResConfig.c b/src/ResConfig.c
index 03867d4..169b22f 100644
--- a/src/ResConfig.c
+++ b/src/ResConfig.c
@@ -118,10 +118,16 @@ _set_resource_values (
Display *dpy;
XrmDatabase tmp_db;
- if (!XtIsWidget (w))
- dpy = XtDisplay (w->core.parent);
- else
- dpy = XtDisplay (w);
+ if (last_part == NULL)
+ return;
+
+ if (!XtIsWidget (w)) {
+ if (w == 0 || w->core.parent == 0)
+ return;
+ dpy = XtDisplay (w->core.parent);
+ } else {
+ dpy = XtDisplay (w);
+ }
tmp_db = XtDatabase(dpy);
/*
@@ -714,33 +720,35 @@ _search_widget_tree (
* Parse last segment off of resource string, (eg. background, font,
* etc.)
*/
- last_token = _get_last_part (remainder, &last_part);
- /*
- * this case covers resources of only one level (eg. *background)
- */
- if (remainder[0] == 0) {
- _set_resource_values (w, resource, value, last_part);
- if (last_token == '*')
- _apply_values_to_children (parent, remainder, resource,
- value, last_token, last_part);
- /*
- * all other resource strings are recursively applied to the widget tree.
- * Prepend a '.' to the remainder string if there is no leading token.
- */
- } else {
- char *indx, *copy;
- if (remainder[0] != '*' && remainder[0] != '.') {
- XtAsprintf (&copy, ".%s", remainder);
- XtFree (remainder);
- remainder = copy;
- }
- indx = remainder;
- _set_and_search (parent, indx, remainder, resource, value,
- last_token, last_part);
+ if (remainder) {
+ last_token = _get_last_part (remainder, &last_part);
+ /*
+ * this case covers resources of only one level (eg. *background)
+ */
+ if (remainder[0] == 0) {
+ _set_resource_values (w, resource, value, last_part);
+ if (last_token == '*')
+ _apply_values_to_children (parent, remainder, resource,
+ value, last_token, last_part);
+ /*
+ * all other resource strings are recursively applied to the widget tree.
+ * Prepend a '.' to the remainder string if there is no leading token.
+ */
+ } else {
+ char *indx, *copy;
+ if (remainder[0] != '*' && remainder[0] != '.') {
+ XtAsprintf (&copy, ".%s", remainder);
+ XtFree (remainder);
+ remainder = copy;
+ }
+ indx = remainder;
+ _set_and_search (parent, indx, remainder, resource, value,
+ last_token, last_part);
+ }
+
+ XtFree (remainder);
+ XtFree (last_part);
}
-
- XtFree (remainder);
- XtFree (last_part);
}
/*
diff --git a/src/Resources.c b/src/Resources.c
index dbb2fa5..83ffd4c 100644
--- a/src/Resources.c
+++ b/src/Resources.c
@@ -941,7 +941,7 @@ XtCacheRef *_XtGetResources(
XrmQuark quark_cache[100];
XrmQuarkList quark_args;
WidgetClass wc;
- XtCacheRef *cache_refs;
+ XtCacheRef *cache_refs = NULL;
Cardinal count;
wc = XtClass(w);
@@ -949,38 +949,41 @@ XtCacheRef *_XtGetResources(
count = CountTreeDepth(w);
names = (XrmName*) XtStackAlloc (count * sizeof(XrmName), names_s);
classes = (XrmClass*) XtStackAlloc (count * sizeof(XrmClass), classes_s);
- if (names == NULL || classes == NULL) _XtAllocError(NULL);
-
- /* Get names, classes for widget and ancestors */
- GetNamesAndClasses(w, names, classes);
+ if (names == NULL || classes == NULL) {
+ _XtAllocError(NULL);
+ } else {
- /* Compile arg list into quarks */
- CacheArgs(args, num_args, typed_args, *num_typed_args, quark_cache,
- XtNumber(quark_cache), &quark_args);
+ /* Get names, classes for widget and ancestors */
+ GetNamesAndClasses(w, names, classes);
- /* Get normal resources */
- LOCK_PROCESS;
- cache_refs = GetResources(w, (char*)w, names, classes,
- (XrmResourceList *) wc->core_class.resources,
- wc->core_class.num_resources, quark_args, args, num_args,
- typed_args, num_typed_args, XtIsWidget(w));
-
- if (w->core.constraints != NULL) {
- ConstraintWidgetClass cwc;
- XtCacheRef *cache_refs_core;
-
- cwc = (ConstraintWidgetClass) XtClass(w->core.parent);
- cache_refs_core =
- GetResources(w, (char*)w->core.constraints, names, classes,
- (XrmResourceList *) cwc->constraint_class.resources,
- cwc->constraint_class.num_resources,
- quark_args, args, num_args, typed_args, num_typed_args, False);
- XtFree((char *)cache_refs_core);
+ /* Compile arg list into quarks */
+ CacheArgs(args, num_args, typed_args, *num_typed_args, quark_cache,
+ XtNumber(quark_cache), &quark_args);
+
+ /* Get normal resources */
+ LOCK_PROCESS;
+ cache_refs = GetResources(w, (char*)w, names, classes,
+ (XrmResourceList *) wc->core_class.resources,
+ wc->core_class.num_resources, quark_args, args, num_args,
+ typed_args, num_typed_args, XtIsWidget(w));
+
+ if (w->core.constraints != NULL) {
+ ConstraintWidgetClass cwc;
+ XtCacheRef *cache_refs_core;
+
+ cwc = (ConstraintWidgetClass) XtClass(w->core.parent);
+ cache_refs_core =
+ GetResources(w, (char*)w->core.constraints, names, classes,
+ (XrmResourceList *) cwc->constraint_class.resources,
+ cwc->constraint_class.num_resources,
+ quark_args, args, num_args, typed_args, num_typed_args, False);
+ XtFree((char *)cache_refs_core);
+ }
+ FreeCache(quark_cache, quark_args);
+ UNLOCK_PROCESS;
+ XtStackFree((XtPointer)names, names_s);
+ XtStackFree((XtPointer)classes, classes_s);
}
- FreeCache(quark_cache, quark_args);
- UNLOCK_PROCESS;
- XtStackFree((XtPointer)names, names_s);
- XtStackFree((XtPointer)classes, classes_s);
return cache_refs;
} /* _XtGetResources */
@@ -1013,35 +1016,37 @@ void _XtGetSubresources (
count++; /* make sure there's enough room for name and class */
names = (XrmName*) XtStackAlloc(count * sizeof(XrmName), names_s);
classes = (XrmClass*) XtStackAlloc(count * sizeof(XrmClass), classes_s);
- if (names == NULL || classes == NULL) _XtAllocError(NULL);
-
- /* Get full name, class of subobject */
- GetNamesAndClasses(w, names, classes);
- count -= 2;
- names[count] = StringToName(name);
- classes[count] = StringToClass(class);
- count++;
- names[count] = NULLQUARK;
- classes[count] = NULLQUARK;
+ if (names == NULL || classes == NULL) {
+ _XtAllocError(NULL);
+ } else {
+ /* Get full name, class of subobject */
+ GetNamesAndClasses(w, names, classes);
+ count -= 2;
+ names[count] = StringToName(name);
+ classes[count] = StringToClass(class);
+ count++;
+ names[count] = NULLQUARK;
+ classes[count] = NULLQUARK;
- /* Compile arg list into quarks */
- CacheArgs(args, num_args, typed_args, num_typed_args,
- quark_cache, XtNumber(quark_cache), &quark_args);
+ /* Compile arg list into quarks */
+ CacheArgs(args, num_args, typed_args, num_typed_args,
+ quark_cache, XtNumber(quark_cache), &quark_args);
- /* Compile resource list if needed */
- if (((int) resources->resource_offset) >= 0) {
- XrmCompileResourceListEphem(resources, num_resources);
+ /* Compile resource list if needed */
+ if (((int) resources->resource_offset) >= 0) {
+ XrmCompileResourceListEphem(resources, num_resources);
+ }
+ table = _XtCreateIndirectionTable(resources, num_resources);
+ Resrc = GetResources(w, (char*)base, names, classes, table, num_resources,
+ quark_args, args, num_args,
+ typed_args, &ntyped_args, False);
+ FreeCache(quark_cache, quark_args);
+ XtFree((char *)table);
+ XtFree((char *)Resrc);
+ XtStackFree((XtPointer)names, names_s);
+ XtStackFree((XtPointer)classes, classes_s);
+ UNLOCK_APP(app);
}
- table = _XtCreateIndirectionTable(resources, num_resources);
- Resrc = GetResources(w, (char*)base, names, classes, table, num_resources,
- quark_args, args, num_args,
- typed_args, &ntyped_args, False);
- FreeCache(quark_cache, quark_args);
- XtFree((char *)table);
- XtFree((char *)Resrc);
- XtStackFree((XtPointer)names, names_s);
- XtStackFree((XtPointer)classes, classes_s);
- UNLOCK_APP(app);
}
void XtGetSubresources (
@@ -1093,17 +1098,24 @@ void _XtGetApplicationResources (
XtPerDisplay pd = _XtGetPerDisplay(_XtDefaultAppContext()->list[0]);
names = (XrmName*) XtStackAlloc (2 * sizeof(XrmName), names_s);
classes = (XrmClass*) XtStackAlloc (2 * sizeof(XrmClass), classes_s);
- names[0] = pd->name;
- names[1] = NULLQUARK;
- classes[0] = pd->class;
- classes[1] = NULLQUARK;
+ if (names == NULL || classes == NULL) {
+ _XtAllocError(NULL);
+ } else {
+ names[0] = pd->name;
+ names[1] = NULLQUARK;
+ classes[0] = pd->class;
+ classes[1] = NULLQUARK;
+ }
}
else {
Cardinal count = CountTreeDepth(w);
names = (XrmName*) XtStackAlloc(count * sizeof(XrmName), names_s);
classes = (XrmClass*) XtStackAlloc(count * sizeof(XrmClass), classes_s);
- if (names == NULL || classes == NULL) _XtAllocError(NULL);
- GetNamesAndClasses(w, names, classes);
+ if (names == NULL || classes == NULL) {
+ _XtAllocError(NULL);
+ } else {
+ GetNamesAndClasses(w, names, classes);
+ }
}
/* Compile arg list into quarks */
diff --git a/src/SetValues.c b/src/SetValues.c
index 5fd0e6b..cbfd680 100644
--- a/src/SetValues.c
+++ b/src/SetValues.c
@@ -155,20 +155,22 @@ CallConstraintSetValues (
if ((WidgetClass)class != constraintWidgetClass) {
ConstraintWidgetClass superclass;
- if (class == NULL)
+ if (class == NULL) {
XtAppErrorMsg(XtWidgetToApplicationContext(current),
"invalidClass","constraintSetValue",XtCXtToolkitError,
"Subclass of Constraint required in CallConstraintSetValues",
NULL, NULL);
- LOCK_PROCESS;
- superclass = (ConstraintWidgetClass) class->core_class.superclass;
- UNLOCK_PROCESS;
- redisplay =
- CallConstraintSetValues(superclass,
- current, request, new, args, num_args);
+ } else {
+ LOCK_PROCESS;
+ superclass = (ConstraintWidgetClass) class->core_class.superclass;
+ UNLOCK_PROCESS;
+ redisplay =
+ CallConstraintSetValues(superclass,
+ current, request, new, args, num_args);
+ }
}
LOCK_PROCESS;
- set_values = class->constraint_class.set_values;
+ set_values = class ? class->constraint_class.set_values : NULL;
UNLOCK_PROCESS;
if (set_values)
redisplay |= (*set_values) (current, request, new, args, &num_args);
diff --git a/src/TMparse.c b/src/TMparse.c
index 1782315..9582b0c 100644
--- a/src/TMparse.c
+++ b/src/TMparse.c
@@ -656,25 +656,22 @@ static String FetchModifierToken(
if (*str == '$') {
*token_return = QMeta;
str++;
- return str;
- }
- if (*str == '^') {
+ } else if (*str == '^') {
*token_return = QCtrl;
str++;
- return str;
- }
- str = ScanIdent(str);
- if (start != str) {
- char modStrbuf[100];
- char* modStr;
-
- modStr = XtStackAlloc ((size_t)(str - start + 1), modStrbuf);
- if (modStr == NULL) _XtAllocError (NULL);
- (void) memmove(modStr, start, (size_t) (str - start));
- modStr[str-start] = '\0';
- *token_return = XrmStringToQuark(modStr);
- XtStackFree (modStr, modStrbuf);
- return str;
+ } else {
+ str = ScanIdent(str);
+ if (start != str) {
+ char modStrbuf[100];
+ char* modStr;
+
+ modStr = XtStackAlloc ((size_t)(str - start + 1), modStrbuf);
+ if (modStr == NULL) _XtAllocError (NULL);
+ (void) memmove(modStr, start, (size_t) (str - start));
+ modStr[str-start] = '\0';
+ *token_return = XrmStringToQuark(modStr);
+ XtStackFree (modStr, modStrbuf);
+ }
}
return str;
}
@@ -687,7 +684,7 @@ static String ParseModifiers(
register String start;
Boolean notFlag, exclusive, keysymAsMod;
Value maskBit;
- XrmQuark Qmod;
+ XrmQuark Qmod = QNone;
ScanWhitespace(str);
start = str;
@@ -959,7 +956,7 @@ static String ParseKeySym(
{
String start;
char keySymNamebuf[100];
- char* keySymName;
+ char* keySymName = NULL;
ScanWhitespace(str);
@@ -996,7 +993,7 @@ static String ParseKeySym(
event->event.eventCode = StringToKeySym(keySymName, error);
event->event.eventCodeMask = (unsigned long) (~0L);
}
- if (*error) {
+ if (*error && keySymName) {
/* We never get here when keySymName hasn't been allocated */
if (keySymName[0] == '<') {
/* special case for common error */
@@ -1776,9 +1773,11 @@ static String ParseActionSeq(
ActionPtr *actionsP,
Boolean *error)
{
- ActionPtr *nextActionP = actionsP;
+ ActionPtr *nextActionP;
+
+ if ((nextActionP = actionsP) != NULL)
+ *actionsP = NULL;
- *actionsP = NULL;
while (*str != '\0' && !IsNewline(*str)) {
register ActionPtr action;
XrmQuark quark;
@@ -1796,8 +1795,10 @@ static String ParseActionSeq(
action->idx = _XtGetQuarkIndex(parseTree, quark);
ScanWhitespace(str);
- *nextActionP = action;
- nextActionP = &action->next;
+ if (nextActionP) {
+ *nextActionP = action;
+ nextActionP = &action->next;
+ }
}
if (IsNewline(*str)) str++;
ScanWhitespace(str);
@@ -1843,21 +1844,18 @@ static String ParseTranslationTableProduction(
String production = str;
actionsP = NULL;
- str = ParseEventSeq(str, &eventSeq, &actionsP,error);
- if (*error == TRUE) {
- ShowProduction(production);
- FreeEventSeq(eventSeq);
- return (str);
- }
- ScanWhitespace(str);
- str = ParseActionSeq(parseTree, str, actionsP, error);
+ str = ParseEventSeq(str, &eventSeq, &actionsP, error);
if (*error == TRUE) {
ShowProduction(production);
- FreeEventSeq(eventSeq);
- return (str);
+ } else {
+ ScanWhitespace(str);
+ str = ParseActionSeq(parseTree, str, actionsP, error);
+ if (*error == TRUE) {
+ ShowProduction(production);
+ } else {
+ _XtAddEventSeqToStateTree(eventSeq, parseTree);
+ }
}
-
- _XtAddEventSeqToStateTree(eventSeq, parseTree);
FreeEventSeq(eventSeq);
return (str);
}
diff --git a/src/TMstate.c b/src/TMstate.c
index 70ee5dd..0856909 100644
--- a/src/TMstate.c
+++ b/src/TMstate.c
@@ -1765,7 +1765,8 @@ static XtTranslations UnmergeTranslations(
else
first = NULL;
- if (xlations->composers[1]) {
+ if (xlations->composers[0]
+ && xlations->composers[1]) {
second = UnmergeTranslations(widget, xlations->composers[1],
unmergeXlations,
(TMShortCard)(currIndex +
diff --git a/src/Varargs.c b/src/Varargs.c
index 0368209..76bbeb9 100644
--- a/src/Varargs.c
+++ b/src/Varargs.c
@@ -350,7 +350,7 @@ _XtVaToArgList(
ArgList args = (ArgList)NULL;
XtTypedArg typed_arg;
XtResourceList resources = (XtResourceList)NULL;
- Cardinal num_resources;
+ Cardinal num_resources = 0;
Boolean fetched_resource_list = False;
if (max_count == 0) {
@@ -360,44 +360,48 @@ _XtVaToArgList(
}
args = (ArgList)__XtMalloc((Cardinal)((size_t)(max_count * 2) * sizeof(Arg)));
- for (count = max_count * 2; --count >= 0; )
- args[count].value = (XtArgVal) NULL;
- count = 0;
-
- for(attr = va_arg(var, String) ; attr != NULL;
- attr = va_arg(var, String)) {
- if (strcmp(attr, XtVaTypedArg) == 0) {
- typed_arg.name = va_arg(var, String);
- typed_arg.type = va_arg(var, String);
- typed_arg.value = va_arg(var, XtArgVal);
- typed_arg.size = va_arg(var, int);
-
- /* if widget is NULL, typed args are ignored */
- if (widget != NULL) {
- if (!fetched_resource_list) {
- GetResources(widget, &resources, &num_resources);
- fetched_resource_list = True;
+ if (args) {
+ for (count = max_count * 2; --count >= 0; )
+ args[count].value = (XtArgVal) NULL;
+ count = 0;
+
+ for(attr = va_arg(var, String) ; attr != NULL;
+ attr = va_arg(var, String)) {
+ if (strcmp(attr, XtVaTypedArg) == 0) {
+ typed_arg.name = va_arg(var, String);
+ typed_arg.type = va_arg(var, String);
+ typed_arg.value = va_arg(var, XtArgVal);
+ typed_arg.size = va_arg(var, int);
+
+ /* if widget is NULL, typed args are ignored */
+ if (widget != NULL) {
+ if (!fetched_resource_list) {
+ GetResources(widget, &resources, &num_resources);
+ fetched_resource_list = True;
+ }
+ count += TypedArgToArg(widget, &typed_arg, &args[count],
+ resources, num_resources,
+ &args[max_count + count]);
}
- count += TypedArgToArg(widget, &typed_arg, &args[count],
- resources, num_resources,
- &args[max_count + count]);
- }
- } else if (strcmp(attr, XtVaNestedList) == 0) {
- if (widget != NULL) {
- if (!fetched_resource_list) {
- GetResources(widget, &resources, &num_resources);
- fetched_resource_list = True;
+ } else if (strcmp(attr, XtVaNestedList) == 0) {
+ if (widget != NULL) {
+ if (!fetched_resource_list) {
+ GetResources(widget, &resources, &num_resources);
+ fetched_resource_list = True;
+ }
}
- }
- count += NestedArgtoArg(widget, va_arg(var, XtTypedArgList),
- &args[count], resources, num_resources,
- &args[max_count + count]);
- } else {
- args[count].name = attr;
- args[count].value = va_arg(var, XtArgVal);
- count ++;
+ count += NestedArgtoArg(widget, va_arg(var, XtTypedArgList),
+ &args[count], resources, num_resources,
+ &args[max_count + count]);
+ } else {
+ args[count].name = attr;
+ args[count].value = va_arg(var, XtArgVal);
+ count ++;
+ }
}
+ } else {
+ count = 0;
}
XtFree((XtPointer)resources);
@@ -407,7 +411,7 @@ _XtVaToArgList(
}
/* Function Name: GetResources
- * Description: Retreives the normal and constraint resources
+ * Description: Retrieves the normal and constraint resources
* for this widget.
* Arguments: widget - the widget.
* RETURNED res_list - the list of resource for this widget