rem: char *wclass, *winstance;
context: restore_icon_state(WScreen *scr, proplist_t info, int type, int index){    WAppIcon *aicon;    char *wclass, *winstance;    proplist_t cmd, value;    char *command;    cmd = PLGetDictionaryEntry(info, dCommand);    if (!cmd || !PLIsString(cmd)) {	return NULL;    }    /* parse window name */    value = PLGetDictionaryEntry(info, dName);    if (!value)	return NULL;    ParseWindowName(value, &winstance, &wclass, "dock");    if (!winstance && !wclass) {	return NULL;    }    /* get commands */    if (cmd)	command = wstrdup(PLGetString(cmd));    else	command = NULL;    if (!command || strcmp(command, "-")==0) {	if (command)	    free(command);	if (wclass)	    free(wclass);	if (winstance)	    free(winstance);	return NULL;    }    aicon = wAppIconCreateForDock(scr, command, winstance, wclass,				  TILE_NORMAL);    if (wclass)	free(wclass);    if (winstance)	free(winstance);    aicon->icon->core->descriptor.handle_mousedown = iconMouseDown;    if (type == WM_CLIP) {        aicon->icon->core->descriptor.handle_enternotify = clipEnterNotify;        aicon->icon->core->descriptor.handle_leavenotify = clipLeaveNotify;    }    aicon->icon->core->descriptor.parent_type = WCLASS_DOCK_ICON;    aicon->icon->core->descriptor.parent = aicon;#ifdef OFFIX_DND    cmd = PLGetDictionaryEntry(info, dDropCommand);    if (cmd)	aicon->dnd_command = wstrdup(PLGetString(cmd));#endif    /* check auto launch */    value = PLGetDictionaryEntry(info, dAutoLaunch);    aicon->auto_launch = getBooleanDockValue(value, dAutoLaunch);    /* check lock */    value = PLGetDictionaryEntry(info, dLock);    aicon->lock = getBooleanDockValue(value, dLock);    /* check if it wasn't normally docked */    value = PLGetDictionaryEntry(info, dForced);    aicon->forced_dock = getBooleanDockValue(value, dForced);    /* check if we can rely on the stuff in the app */    value = PLGetDictionaryEntry(info, dBuggyApplication);    aicon->buggy_app = getBooleanDockValue(value, dBuggyApplication);    /* get position in the dock */    value = PLGetDictionaryEntry(info, dPosition);    if (value && PLIsString(value)) {        if (sscanf(PLGetString(value), "%hi,%hi", &aicon->xindex,                   &aicon->yindex)!=2)            wwarning(_("bad value in docked icon state info %s"),                     PLGetString(dPosition));        /* check position sanity */        /* incomplete section! */        if (type == WM_DOCK) {            aicon->xindex = 0;            if (aicon->yindex < 0)                wwarning(_("bad value in docked icon position %i,%i"),                         aicon->xindex, aicon->yindex);        }    } else {        aicon->yindex = index;        aicon->xindex = 0;    }    /* check if icon is omnipresent */    value = PLGetDictionaryEntry(info, dOmnipresent);    aicon->omnipresent = getBooleanDockValue(value, dOmnipresent);    aicon->running = 0;    aicon->docked = 1;    return aicon;}