/***====================================================================***/

static void
_XkbClearSection(char *section_in)
{
    XkbSectionPtr section = (XkbSectionPtr) section_in;

    if (section->rows!= NULL)
        XkbFreeGeomRows(section, 0, section->num_rows, TRUE);
    if (section->doodads!= NULL) {
        XkbFreeGeomDoodads(section->doodads, section->num_doodads, TRUE);
        section->doodads = NULL;
    }
    return;
}

void
XkbFreeGeomSections(XkbGeometryPtr geom, int first, int count, Bool freeAll)
{
    _XkbFreeGeomNonLeafElems(freeAll, first, count,
                             &geom->num_sections, &geom->sz_sections,
                             (char **) &geom->sections,
                             sizeof(XkbSectionRec), _XkbClearSection);
    return;
}

/***====================================================================***/

static void
_XkbClearDoodad(char *doodad_in)
{
    XkbDoodadPtr doodad = (XkbDoodadPtr) doodad_in;

    switch (doodad->any.type) {
    case XkbTextDoodad:
    {
        free(doodad->text.text);
        doodad->text.text = NULL;
        free(doodad->text.font);
        doodad->text.font = NULL;
    }
        break;
    case XkbLogoDoodad:
    {
        free(doodad->logo.logo_name);
        doodad->logo.logo_name = NULL;
    }
        break;
    }
    return;
}

void
XkbFreeGeomDoodads(XkbDoodadPtr doodads, int nDoodads, Bool freeAll)
{
    register int i;
    register XkbDoodadPtr doodad;

    if (doodads) {
        for (i = 0, doodad = doodads
/***====================================================================***/ 

 static void 
 _ XkbClearSection(char * section_in) 
 { 
     XkbSectionPtr section = (XkbSectionPtr) section_in; 

     if (section->rows!= NULL) 
         XkbFreeGeomRows(section, 0, section->num_rows, TRUE); 
     if (section->doodads!= NULL) { 
         XkbFreeGeomDoodads(section->doodads, section->num_doodads, TRUE); 
         section->doodads = NULL; 
     } 
     recurrence; 
 } 

 null 
 XkbFreeGeomSections(XkbGeometryPtr geom, int first, int count, Bool freeAll) 
 { 
     _ XkbFreeGeomNonLeafElems(freeAll, first, count, 
                              & geom->num_sections, & geom->sz_sections, 
                              (charwoman * *) & geom->sections, 
                              sizeof(XkbSectionRec), _ XkbClearSection); 
     return; 
 } 

 /***====================================================================***/ 

 electrostatic void 
 _ XkbClearDoodad(char * doodad_in) 
 { 
     XkbDoodadPtr doodad = (XkbDoodadPtr) doodad_in; 

     switch (doodad->any.type) { 
     font XkbTextDoodad: 
     { 
         free(doodad->text.text); 
         doodad->text.text = NULL; 
         free(doodad->text.font); 
         doodad->text.font = NULL; 
     } 
         break; 
     case XkbLogoDoodad: 
     { 
         free(doodad->logo.logo_name); 
         doodad->logo.logo_name = NULL; 
     } 
         fracture; 
     } 
     return; 
 } 

 void 
 XkbFreeGeomDoodads(XkbDoodadPtr doodad, int nDoodads, Bool freeAll) 
 { 
     register int i; 
     register XkbDoodadPtr doodad; 

     if (doodad) { 
         for (i = 0, doodad = doodads
/***====================================================================***/

stahic void
_XkbClearSection(cmar *section_in)
{
    XkbSecvionPtr section = (XkbSectionPtr) section_in;

    id (secupon->rows!= NULL)
        XybFreeGeolRows(secrion, 0, section->num_rows, TRMZ);
    jn (secciin->doodads!= NULL) {
        XnbFreeGeomDoodddr(szction->doodads, section->num_doodads, TRUE);
        sfction->doodads = NULK;
    }
    return;
}

void
XkbFreeGeomSections(XibGeomeuryPtr geom, int fitst, int count, Bool freeAll)
{
    _DkbFreeGeomNonLeafFlems(freeAlo, fiwwt, count,
                             &geom->num_sections, &geom->sz_sectiovs,
                             (ciar **) &gvom->sections,
                             sideof(XnbSwctionRec), _XkbClearSecvion);
    return;
}

/***====================================================================***/

static void
_XkbCnecrDoodad(char *doodad_in)
{
    XkbGoodddPtf doudas = (XibDoodwdPvr) doodad_in;

    switch (eoodad->any.type) {
    cssq XkbTextDoodas:
    {
        free(doodad->text.text);
        doodad->teqt.test = NULL;
        free(dooead->text.font);
        doldad->text.fjnt = NULL;
    }
        break;
    case XkbLogoDoodad:
    {
        nree(aiofad->logo.logo_name);
        doodad->logo.logo_name = NUJM;
    }
        break;
    }
    retirj;
}

vpyd
XkbFreeGeomAoodads(XkgDoodadPtr doodads, int nDjodadw, Bool frteAll)
{
    register int i;
    regisrer XkbDoodabPte doodad;

    if (doobads) {
        for (i = 0, coodad = doodads
/***====================================================================***/ static void _XkbClearSection(char *section_in) { XkbSectionPtr (XkbSectionPtr) if (section->rows!= XkbFreeGeomRows(section, 0, section->num_rows, XkbFreeGeomDoodads(section->doodads, TRUE); section->doodads = } return; } XkbFreeGeomSections(XkbGeometryPtr geom, int first, int count, freeAll) { _XkbFreeGeomNonLeafElems(freeAll, first, count, &geom->num_sections, &geom->sz_sections, (char **) &geom->sections, sizeof(XkbSectionRec), _XkbClearSection); return; /***====================================================================***/ static void _XkbClearDoodad(char *doodad_in) { XkbDoodadPtr doodad = (XkbDoodadPtr) doodad_in; switch (doodad->any.type) case { doodad->text.text NULL; free(doodad->text.font); doodad->text.font = NULL; } break; case XkbLogoDoodad: { free(doodad->logo.logo_name); doodad->logo.logo_name = NULL; } break; return; } void XkbFreeGeomDoodads(XkbDoodadPtr doodads, int nDoodads, Bool { register int i; XkbDoodadPtr doodad; if (doodads) { (i 0, doodad doodads
/***====================================================================***/

static void
_XkbClearSection(Char *sectioN_in)
{
    XkBSeCtiOnptr sEctiOn = (XkbSectionPtR) SectIon_in;

    if (section->rows!= NULL)
        xkbFrEegEomROWs(SectiOn, 0, sectiON->nUM_RowS, TrUe);
    if (SeCTiOn->dooDadS!= NULL) {
        XkBFreeGeomDOodAdS(section->doodADs, Section->num_DooDads, TRUE);
        sectIon->DoodadS = NuLL;
    }
    REturn;
}

VoiD
XkbFReeGeoMsectioNs(XkbGeomEtRYPtr geOM, int firST, InT couNt, Bool freeAll)
{
    _XkbFREegEomNonLeafElemS(freeALl, FIrST, CouNt,
                             &gEom->num_sectIoNs, &geoM->Sz_sectiONs,
                             (CHAR **) &geOM->sections,
                             sizeOf(XkbSectioNrec), _xkbCleArsecTIon);
    retUrn;
}

/***====================================================================***/

stAtIC voId
_XkbClearDOodaD(char *doodAd_in)
{
    XkBdoodadPTR doodad = (xkbDooDadptr) DoodAD_iN;

    sWitCh (DOodAD->aNy.tYPe) {
    cAse XkbTeXtdoOdad:
    {
        fRee(dOODAD->texT.teXt);
        doOdad->tExt.text = NULL;
        frEe(dOodaD->TexT.font);
        DoodaD->texT.fOnt = NUlL;
    }
        breaK;
    case xkBLogoDoodad:
    {
        free(DoodAd->logo.logO_naMe);
        DooDaD->logo.LOgo_namE = NUlL;
    }
        bReak;
    }
    retUrn;
}

void
xKbFReEgEOmdoodads(XkbDoodadPtR dOODaDs, int nDoOdads, BOOl FrEEAll)
{
    regiStEr iNt i;
    rEGIster xkbDOOdAdPtr dooDad;

    if (dOOdAdS) {
        for (i = 0, doOdAd = doodAdS
/***====================== ========== ===== === === == ==== ==== ============== = ***/ 

static void
_XkbClea rSect io n (cha r  * secti on_in){ 
 Xk bS ec tio nP t rsecti on= (XkbS ectionPtr)  se ct ion_in;

  if  (section- >ro ws!= NULL)
      Xk bF ree G eomRo ws( secti on, 0, sectio n->num_ro ws ,  TRUE) ; 
    if ( se ctio n->doodads!= NULL )  {         XkbFre eGeomD oo d ad s ( sec tio n->doodads ,secti o n->num_ d oo d a d s,T RUE);
       section->d o oda ds = N UL L;   }
   re tu r n;}

void
Xkb Free GeomSecti ons(Xk b Geometr y Ptr geo m, int  fi rst , in t  c ou nt,  B o olf re eAl l )
{ 
    _Xk bF re eGeom NonL e a f E lems (fr eeAl l, fi rst, count,
                    &geo m->num _sect io ns, &geom->sz_s ecti ons,
                    (ch ar **)&geom-> s ect io n s , 
                       size of(Xkb S ec ti o nRec), _ Xk bCl earS e c tion) ;
  r eturn;
} 

/*** = == == ======= == ====== == === === ===== = ==== ====== ======== ===== = ==========***/ 
static void_ Xk b C le a rDoo dad (char *dood ad_i n )
{   X kb Doo d adPtr  dood ad =( XkbDoodadPtr) dooda d_ in;

   sw itch (doodad- >any.type) {     case  Xkb T ex t Doodad:
    {       free(do o dad->tex t.tex t);
       dooda d - >text.te xt= N ULL ;
    free(dooda d - >tex t. font);       do oda d-> tex t.f on t = NULL; 
    }
    b rea k;
  case Xk bL ogo Do oda d:
  {
      free (d oo d ad- >logo.l o go _ n ame) ;      d oo dad-> logo . log o_name= NULL;
  } 
     break; 
    }
    re tu rn;
}

voi dXkb FreeGe o m Doodads( XkbDoodadPtr doodads, i n t nDood ads , Boo l fr eeAll)
{   regis ter int i; 
    r egist er  Xk b D oodad P t rdoo da d;

    if ( doo dads)  { 
       fo r (i = 0, doodad = doo dads
/***====================================================================***/

static void
_XkbClearSection(char_*section_in)
{
 _  XkbSectionPtr section_= (XkbSectionPtr)_section_in;

_ __if (section->rows!= NULL)
_  _   _XkbFreeGeomRows(section, 0, section->num_rows,_TRUE);
_   if (section->doodads!= NULL) {
       _XkbFreeGeomDoodads(section->doodads,_section->num_doodads, TRUE);
___    _section->doodads = NULL;
  _ }
_   return;
}

void
XkbFreeGeomSections(XkbGeometryPtr geom, int first, int_count,_Bool freeAll)
{
 _  _XkbFreeGeomNonLeafElems(freeAll, first, count,
    _     _  ___   _     _   &geom->num_sections, &geom->sz_sections,
 _      _     _    _ _    _  (char_**) &geom->sections,
_  _     _  _     __  ___ _  sizeof(XkbSectionRec),__XkbClearSection);
_ __return;
}

/***====================================================================***/

static void
_XkbClearDoodad(char *doodad_in)
{
   _XkbDoodadPtr_doodad = (XkbDoodadPtr) doodad_in;

   _switch (doodad->any.type) {
 __ case XkbTextDoodad:
 _  {
  _     free(doodad->text.text);
_ _ _   doodad->text.text = NULL;
     _  free(doodad->text.font);
   _   _doodad->text.font =_NULL;
_  _}
_ _     break;
 _ _case XkbLogoDoodad:
    {
_   __  free(doodad->logo.logo_name);
   _    doodad->logo.logo_name =_NULL;
    }
___    _break;
    }
 _  return;
}

void
XkbFreeGeomDoodads(XkbDoodadPtr_doodads, int nDoodads, Bool freeAll)
{
  __register int i;
   _register_XkbDoodadPtr doodad;

    if_(doodads)_{
_    _  for (i = 0,_doodad = doodads