diff options
author | Kjell Wooding <kjell@cvs.openbsd.org> | 2005-12-13 05:23:04 +0000 |
---|---|---|
committer | Kjell Wooding <kjell@cvs.openbsd.org> | 2005-12-13 05:23:04 +0000 |
commit | 699af870e894885571a2a2343adbc1359452f7a5 (patch) | |
tree | 69bf9b2ac39874d46d45baa1121d11acf07b8644 /usr.bin/mg/region.c | |
parent | 2ccbc88c9cbe4f3f3cb7a426efafcd1a6392eb68 (diff) |
If you're going to pass a length parameter, you should use it.
Diffstat (limited to 'usr.bin/mg/region.c')
-rw-r--r-- | usr.bin/mg/region.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/usr.bin/mg/region.c b/usr.bin/mg/region.c index dc0c0c50b60..7df2c891db0 100644 --- a/usr.bin/mg/region.c +++ b/usr.bin/mg/region.c @@ -1,4 +1,4 @@ -/* $OpenBSD: region.c,v 1.19 2005/11/18 20:56:53 deraadt Exp $ */ +/* $OpenBSD: region.c,v 1.20 2005/12/13 05:23:03 kjell Exp $ */ /* This file is in the public domain. */ @@ -348,16 +348,15 @@ region_get_data(struct region *reg, char *buf, int len) return (i); } -int +void region_put_data(const char *buf, int len) { int i; - for (i = 0; buf[i]; i++) { + for (i = 0; buf[i] != NULL && i < len; i++) { if (buf[i] == '\n') lnewline(); else linsert(1, buf[i]); } - return (0); } |