[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemacs-commit] qemacs buffer.c clang.c qe.h
From: |
Charlie Gordon |
Subject: |
[Qemacs-commit] qemacs buffer.c clang.c qe.h |
Date: |
Sat, 15 Dec 2007 16:33:20 +0000 |
CVSROOT: /cvsroot/qemacs
Module name: qemacs
Changes by: Charlie Gordon <chqrlie> 07/12/15 16:33:20
Modified files:
. : buffer.c clang.c qe.h
Log message:
added ssizeof, cosmetics
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/buffer.c?cvsroot=qemacs&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/qemacs/clang.c?cvsroot=qemacs&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.h?cvsroot=qemacs&r1=1.35&r2=1.36
Patches:
Index: buffer.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/buffer.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- buffer.c 15 Dec 2007 16:02:48 -0000 1.17
+++ buffer.c 15 Dec 2007 16:33:20 -0000 1.18
@@ -689,7 +689,7 @@
/* XXX: better test to limit size */
if (b->nb_logs >= (NB_LOGS_MAX-1)) {
/* no free space, delete least recent entry */
- eb_read(b->log_buffer, 0, (unsigned char *)&lb, sizeof(LogBuffer));
+ eb_read(b->log_buffer, 0, &lb, sizeof(LogBuffer));
len = lb.size;
if (lb.op == LOGOP_INSERT)
len = 0;
@@ -753,14 +753,14 @@
}
/* go backward */
log_index -= sizeof(int);
- eb_read(b->log_buffer, log_index, (unsigned char *)&size_trailer,
sizeof(int));
+ eb_read(b->log_buffer, log_index, &size_trailer, sizeof(int));
log_index -= size_trailer + sizeof(LogBuffer);
/* log_current is 1 + index to have zero as default value */
b->log_current = log_index + 1;
/* play the log entry */
- eb_read(b->log_buffer, log_index, (unsigned char *)&lb, sizeof(LogBuffer));
+ eb_read(b->log_buffer, log_index, &lb, sizeof(LogBuffer));
log_index += sizeof(LogBuffer);
switch (lb.op) {
@@ -856,7 +856,7 @@
if (b->charset == &charset_utf8) {
while (*q >= 0x80 && *q < 0xc0) {
if (offset == 0 || q == buf) {
- /* error : take only previous char */
+ /* error: take only previous char */
offset += buf - 1 - q;
ch = buf[sizeof(buf) - 1];
goto the_end;
Index: clang.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/clang.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- clang.c 15 Dec 2007 16:02:48 -0000 1.15
+++ clang.c 15 Dec 2007 16:33:20 -0000 1.16
@@ -326,8 +326,8 @@
/* insert needed spaces */
while (i > 0) {
size = i;
- if (size > (int)sizeof(buf1))
- size = (int)sizeof(buf1);
+ if (size > ssizeof(buf1))
+ size = ssizeof(buf1);
memset(buf1, ' ', size);
eb_insert(s->b, offset, buf1, size);
i -= size;
@@ -458,7 +458,7 @@
p--;
p2 = p;
q = buf1;
- while (q < buf1 + sizeof(buf1) - 1 && p2 <= p1) {
+ while (q < buf1 + countof(buf1) - 1 && p2 <= p1) {
*q++ = *p2++ & CHAR_MASK;
}
*q = '\0';
Index: qe.h
===================================================================
RCS file: /cvsroot/qemacs/qemacs/qe.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -b -r1.35 -r1.36
--- qe.h 15 Dec 2007 16:02:48 -0000 1.35
+++ qe.h 15 Dec 2007 16:33:20 -0000 1.36
@@ -66,6 +66,9 @@
#ifndef countof
#define countof(a) ((int)(sizeof(a) / sizeof((a)[0])))
#endif
+#ifndef ssizeof
+#define ssizeof(a) ((int)(sizeof(a)))
+#endif
/************************/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemacs-commit] qemacs buffer.c clang.c qe.h,
Charlie Gordon <=