projects
/
onak.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Log when we're doing a clean keyd shutdown
[onak.git]
/
charfuncs.c
diff --git
a/charfuncs.c
b/charfuncs.c
index f509fc8653948e6645b8c3c797698de7cab27bba..778df1ca477732fac168895fc3094e45af329ae4 100644
(file)
--- a/
charfuncs.c
+++ b/
charfuncs.c
@@
-4,11
+4,10
@@
* Jonathan McDowell <noodles@earth.li>
*
* Copyright 2002 Project Purple
* Jonathan McDowell <noodles@earth.li>
*
* Copyright 2002 Project Purple
- *
- * $Id: charfuncs.c,v 1.4 2003/10/04 10:21:40 noodles Exp $
*/
#include <stdio.h>
*/
#include <stdio.h>
+#include <string.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <unistd.h>
@@
-24,12
+23,11
@@
int buffer_fetchchar(void *ctx, size_t count, unsigned char *c)
{
struct buffer_ctx *buf = NULL;
int buffer_fetchchar(void *ctx, size_t count, unsigned char *c)
{
struct buffer_ctx *buf = NULL;
- size_t i;
buf = (struct buffer_ctx *) ctx;
buf = (struct buffer_ctx *) ctx;
- for (i = 0; i < count; i++) {
-
c[i] = buf->buffer[buf->offset++]
;
- }
+
+
memcpy(c, &buf->buffer[buf->offset], count)
;
+ buf->offset += count;
return (((buf->offset) == (buf->size)) ? 1 : 0);
}
return (((buf->offset) == (buf->size)) ? 1 : 0);
}
@@
-48,7
+46,6
@@
int buffer_putchar(void *ctx, size_t count, unsigned char *c)
{
struct buffer_ctx *buf = NULL;
size_t newsize = 0;
{
struct buffer_ctx *buf = NULL;
size_t newsize = 0;
- size_t i;
buf = (struct buffer_ctx *) ctx;
buf = (struct buffer_ctx *) ctx;
@@
-59,11
+56,10
@@
int buffer_putchar(void *ctx, size_t count, unsigned char *c)
buf->buffer = realloc(buf->buffer, newsize);
buf->size = newsize;
}
buf->buffer = realloc(buf->buffer, newsize);
buf->size = newsize;
}
-
- for (i = 0; i < count; i++) {
- buf->buffer[buf->offset++] = c[i];
- }
+ memcpy(&buf->buffer[buf->offset], c, count);
+ buf->offset += count;
+
return 1;
}
return 1;
}