Re: [PATCH][2.5] UTF-8 support in console

Chris Heath (chris@heathens.co.nz)
Sat, 31 May 2003 15:37:54 -0400


--------_3ED90286566C050E93A8_MULTIPART_MIXED_
Content-Type: text/plain; charset="US-ASCII"
Content-Transfer-Encoding: 7bit

Here's the patch again, with suggested changes.

> + if (!p) return;
>
> Please split this into two lines. Can p ever be null_

p could never be null, as it turns out. So I removed this line. :-)

> + q = p->inverse_trans_unicode = (u16 *)
> + kmalloc(MAX_GLYPH * sizeof(u16), GFP_KERNEL);
>
> The cast is not needed. And btw, where is q freed?

It is freed. Grep for kfree.*inverse_trans_unicode.

Chris

--------_3ED90286566C050E93A8_MULTIPART_MIXED_
Content-Type: application/octet-stream; name="selection.patch"
Content-Disposition: attachment;
filename="selection.patch"
Content-Transfer-Encoding: base64

LS0tIGEvaW5jbHVkZS9saW51eC9jb25zb2xlbWFwLmgJMjAwMy0wNS0wNCAxOTo1Mzo1Ni4wMDAw
MDAwMDAgLTA0MDAKKysrIGIvaW5jbHVkZS9saW51eC9jb25zb2xlbWFwLmgJMjAwMy0wNS0yNiAx
NToxNzo0NS4wMDAwMDAwMDAgLTA0MDAKQEAgLTEwLDYgKzEwLDYgQEAKIAogc3RydWN0IHZjX2Rh
dGE7CiAKLWV4dGVybiB1bnNpZ25lZCBjaGFyIGludmVyc2VfdHJhbnNsYXRlKHN0cnVjdCB2Y19k
YXRhICpjb25wLCBpbnQgZ2x5cGgpOworZXh0ZXJuIHUxNiBpbnZlcnNlX3RyYW5zbGF0ZShzdHJ1
Y3QgdmNfZGF0YSAqY29ucCwgaW50IGdseXBoLCBpbnQgdXNlX3VuaWNvZGUpOwogZXh0ZXJuIHVu
c2lnbmVkIHNob3J0ICpzZXRfdHJhbnNsYXRlKGludCBtLGludCBjdXJyY29ucyk7CiBleHRlcm4g
aW50IGNvbnZfdW5pX3RvX3BjKHN0cnVjdCB2Y19kYXRhICpjb25wLCBsb25nIHVjcyk7Ci0tLSBh
L2RyaXZlcnMvY2hhci9jb25zb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haWxlZFxuIik7CiAJCWNsZWFyX3NlbGVjdGlvbigpOwpAQCAtMjY0LDggKzI5MiwxMiBAQAog
CiAJb2JwID0gYnA7CiAJZm9yIChpID0gc2VsX3N0YXJ0OyBpIDw9IHNlbF9lbmQ7IGkgKz0gMikg
ewotCQkqYnAgPSBzZWxfcG9zKGkpOwotCQlpZiAoIWlzc3BhY2UoKmJwKyspKQorCQljID0gc2Vs
X3BvcyhpKTsKKwkJaWYgKHVzZV91bmljb2RlKQorCQkJYnAgKz0gc3RvcmVfdXRmOChjLCBicCk7
CisJCWVsc2UKKwkJCSpicCsrID0gYzsKKwkJaWYgKCFpc3NwYWNlKGMpKQogCQkJb2JwID0gYnA7
CiAJCWlmICghICgoaSArIDIpICUgdmlkZW9fc2l6ZV9yb3cpKSB7CiAJCQkvKiBzdHJpcCB0cmFp
bGluZyBibGFua3MgZnJvbSBsaW5lIGFuZCBhZGQgbmV3bGluZSwK

--------_3ED90286566C050E93A8_MULTIPART_MIXED_--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/