dlugolecki.net.pl
Dziennik
Polecane
Software
projects
/
gedcom-parse.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d2233f1
)
Little optimization: one less variable.
author
Peter Verthez
<Peter.Verthez@advalvas.be>
Sun, 25 Nov 2001 18:57:39 +0000
(18:57 +0000)
committer
Peter Verthez
<Peter.Verthez@advalvas.be>
Sun, 25 Nov 2001 18:57:39 +0000
(18:57 +0000)
encoding.c
patch
|
blob
|
history
diff --git
a/encoding.c
b/encoding.c
index bd33b87b63ae096e69d5ac92d40c1f3266ac903e..1104f681999a6e2664f73e38c60cd0a4e0cf69ad 100644
(file)
--- a/
encoding.c
+++ b/
encoding.c
@@
-114,7
+114,7
@@
void set_encoding_width(ENCODING enc)
}
static char conv_buf[MAXGEDCLINELEN * 2];
}
static char conv_buf[MAXGEDCLINELEN * 2];
-static
in
t conv_buf_size;
+static
size_
t conv_buf_size;
int open_conv_to_internal(char* fromcode)
{
int open_conv_to_internal(char* fromcode)
{
@@
-144,7
+144,6
@@
void close_conv_to_internal()
char* to_internal(char* str, size_t len)
{
char* to_internal(char* str, size_t len)
{
- size_t insize;
size_t outsize = MAXGEDCLINELEN * 2;
char *wrptr = int_buf;
char *rdptr = conv_buf;
size_t outsize = MAXGEDCLINELEN * 2;
char *wrptr = int_buf;
char *rdptr = conv_buf;
@@
-152,15
+151,13
@@
char* to_internal(char* str, size_t len)
/* can't use strcpy, because possible null bytes from unicode */
memcpy(conv_buf + conv_buf_size, str, len);
conv_buf_size += len;
/* can't use strcpy, because possible null bytes from unicode */
memcpy(conv_buf + conv_buf_size, str, len);
conv_buf_size += len;
- insize = conv_buf_size;
/* set up output buffer (empty it) */
memset(int_buf, 0, sizeof(int_buf));
/* do the conversion */
/* set up output buffer (empty it) */
memset(int_buf, 0, sizeof(int_buf));
/* do the conversion */
- iconv(cd_to_internal, &rdptr, &
in
size, &wrptr, &outsize);
+ iconv(cd_to_internal, &rdptr, &
conv_buf_
size, &wrptr, &outsize);
/* then shift what is left over to the head of the input buffer */
/* then shift what is left over to the head of the input buffer */
- memmove(conv_buf, rdptr, insize);
- memset(conv_buf + insize, 0, sizeof(conv_buf) - insize);
- conv_buf_size = insize;
+ memmove(conv_buf, rdptr, conv_buf_size);
+ memset(conv_buf + conv_buf_size, 0, sizeof(conv_buf) - conv_buf_size);
return int_buf;
}
return int_buf;
}