Great Circle Associates

XCIN Mail-list
(June 2000)


Indexed By Date: [Previous] [Next] Indexed By Thread: [Previous] [Next]

Subject: Re: how to commit string at xim_end bin doc rms tmp
From: thhsieh@linux.org.tw
Date: Sat, 3 Jun 2000 08:36:09 +0800
To: xcin@linux.org.tw
Reply-To: xcin@linux.org.tw

: ¦n¡A§Ú¦³¤@­ÓÃö©ó xcin internal ªº°ÝÃD·Q½Ð±Ð±z¡G
:   
: ´N¬O»¡¡A§Ú­Ì·QÅý»Å­µ¿é¤Jªk¦b¨Ï¥ÎªÌ«ö¤Uctrl-space  
:   
: ¤§«á¡A¦Û°Ê§âµü°e¥X¡A¦ý¬O¥Ñ©ó¦bxim_end¤¤¡AÁÙ¥²¶·§@
:   
: free(inpinfo->cch)ªº°Ê§@
:   
: ¦p¦¹¤@¨Ó¡A­n°e¦^ xcin³Q commitªº string¤£´NÃa±¼¤F¶Ü¡H  
: 
: ½Ð°Ý¬O§_¦³¤ñ¸û¦nªº¸Ñ¨M¤èªk¡H¡H

³Ì²³æªº°µªk¬O¡A¦b±zªº¿é¤Jªk¼Ò²Õ¤¤¨Ï¥Î¤@­Ó static buffer ¨Ó«O¦s­n³Q
commit ªº¦r¦ê¡A¦AÅý inpinfo->cch «ü¦V¨º­Ó static buffer¡C¥H bimsphone
¬°¨Ò:

static void
commit_string(inpinfo_t *inpinfo, phone_iccf_t *iccf, int n_chars)
{
    static char *str=NULL;

    if (str)
        free(str);
    str = bimsFetchText(inpinfo->imid, n_chars);
#ifdef DEBUG
    DebugLog(1, verbose, "%s\n", str);
#endif
    inpinfo->cch = str;
}

static unsigned int
phone_xim_end(void *conf, inpinfo_t *inpinfo)
{
    unsigned int ret;

    if (inpinfo->n_lcch) {
        commit_string(inpinfo, inpinfo->iccf, inpinfo->n_lcch);
        ret = IMKEY_COMMIT;
    }
    else
        ret = IMKEY_ABSORB;

    bimsFreeBC(inpinfo->imid);
    free(inpinfo->iccf);
    if (inpinfo->lcch)
        free(inpinfo->lcch);
    if (inpinfo->lcch_grouping);
        free(inpinfo->lcch_grouping);
    inpinfo->iccf = NULL;
    inpinfo->s_keystroke = NULL;
    inpinfo->suggest_skeystroke = NULL;
    inpinfo->s_selkey = NULL;
    inpinfo->mcch = NULL;
    inpinfo->mcch_grouping = NULL;
    inpinfo->lcch = NULL;
    inpinfo->lcch_grouping = NULL;

    return ret;
}

¦b³oùØ·Ó²z»¡ xim_end() ­n free() ªºªFªF«Ü¦h¡A¦ý¥Ñ¤WÀY¥i¨£ bimsphone
¥u free ¤F´X­Ó¡A­ì¦]´N¬O¨ä¥Lªº³¡¤À (¦pªG¦³¥Î¨ìªº¸Ü) ¥¦³£¬O¥H static
buffer ¦s¦b©ó bimsphone ¤º³¡¡A¨Ã¥Ñ bimsphone ¦Û¦æºÞ²z¡A¬G¤£·|¦³ memory
leakage ªº²{¶Hµo¥Í¡C


T.H.Hsieh
To Unsubscribe: send mail to majordomo@linux.org.tw
with "unsubscribe xcin" in the body of the message


Follow-Ups:
Indexed By Date Previous: how to commit string at xim_end ???
From: Lu-chuan Kung <b6506053@csie.ntu.edu.tw>
Next: -¥úºÐ±Ú§Ö¯N¯¸¨C¤ù50¤¸°_-----¶W§C»ù­·¼É-----
From: dfsd@yahoo.com
Indexed By Thread Previous: how to commit string at xim_end ???
From: Lu-chuan Kung <b6506053@csie.ntu.edu.tw>
Next: Re: how to commit string at xim_end bin doc rms tmp
From: Kang-pen Chen <b86059@ee.ntu.edu.tw>