Menu

#258 Code suggestion

feature request
closed-fixed
fonts (40)
5
2005-02-05
2005-02-05
No

This patch removes multiple code which warns that xdvi
is compiled without iconv.
It helps us to add Japanese support.

Another suggestion is to use such a macro

#define strNcmp(src,dst) memcmp(src, dst, strlen(src))

in order to simplify

memcmp(fontname, "lcircle", strlen("lcircle"))

to

strNcmp("lcircle", fontname)

in encodings.c.

Thanks!

Discussion

  • Nobuyuki Tsuchimura

    Removes multiple code in encodings.c

     
  • Stefan Ulrich

    Stefan Ulrich - 2005-02-05

    Logged In: YES
    user_id=177175

    Thanks very much for the suggestions; I've applied the patch
    to the CVS trunk and STABLE branch and added a macro

    #define HAS_PREFIX(src,dst) (memcmp(src, dst, strlen(src)) == 0)

    to the trunk.

     
  • Stefan Ulrich

    Stefan Ulrich - 2005-02-05
    • assigned_to: nobody --> stefanulrich
    • status: open --> closed-fixed
     
  • Nobuyuki Tsuchimura

    Logged In: YES
    user_id=599487

    Thank you for quick response and nice job.
    'HAS_PREFIX' is a better name.

    I guess you mean the macro shoud be following.

    #define HAS_PREFIX(src,dst) (memcmp(src, dst, strlen(dst)) == 0)
    ^^^
    We need the length of 'dst', not 'src'
    when we test HAS_PREFIX(fontname, "lcircle").

     
  • Stefan Ulrich

    Stefan Ulrich - 2005-02-06

    Logged In: YES
    user_id=177175

    > #define HAS_PREFIX(src,dst) (memcmp(src, dst, strlen(dst))
    == 0)

    Ouch, you're right; fixed now in HEAD.

     

Log in to post a comment.

Auth0 Logo