Use termkey_set_flags() in constructor rather than copypasted logic

This commit is contained in:
Paul LeoNerd Evans 2012-01-26 10:07:23 +00:00
parent f9fe338e3e
commit 8b46e65aa3
1 changed files with 3 additions and 5 deletions

View File

@ -217,6 +217,8 @@ TermKey *termkey_new(int fd, int flags)
if(!tk) if(!tk)
return NULL; return NULL;
tk->fd = fd;
if(!(flags & (TERMKEY_FLAG_RAW|TERMKEY_FLAG_UTF8))) { if(!(flags & (TERMKEY_FLAG_RAW|TERMKEY_FLAG_UTF8))) {
int locale_is_utf8 = 0; int locale_is_utf8 = 0;
char *e; char *e;
@ -236,11 +238,7 @@ TermKey *termkey_new(int fd, int flags)
flags |= TERMKEY_FLAG_RAW; flags |= TERMKEY_FLAG_RAW;
} }
tk->fd = fd; termkey_set_flags(tk, flags);
tk->flags = flags;
if(flags & TERMKEY_FLAG_SPACESYMBOL)
tk->canonflags |= TERMKEY_CANON_SPACESYMBOL;
tk->buffer = malloc(tk->buffsize); tk->buffer = malloc(tk->buffsize);
if(!tk->buffer) if(!tk->buffer)