File: bzero-bcopy.patch

package info (click to toggle)
proll 18-6
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,640 kB
  • sloc: ansic: 13,356; asm: 2,719; makefile: 635
file content (81 lines) | stat: -rw-r--r-- 1,654 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
Author: Guillem Jover <guillem@debian.org>

---
 qemu/system_qemu.c |   18 ++++++++++++++----
 src/system.c       |   18 ++++++++++++++----
 2 files changed, 28 insertions(+), 8 deletions(-)

--- a/src/system.c
+++ b/src/system.c
@@ -515,11 +515,18 @@ void *mem_zalloc(struct mem *t, int size
  * Library functions
  */
 void bzero(void *s, int len) {
-	while (len--) *((char *)s)++ = 0;
+	while (len--) {
+		*(char *)s = 0;
+		s++;
+	}
 }
 
 void bcopy(const void *f, void *t, int len) {
-	while (len--) *((char *)t)++ = *((char *)f)++;
+	while (len--) {
+		*(char *)t = *(char *)f;
+		f++;
+		t++;
+	}
 }
 
 /* Comparison is 7-bit */
@@ -529,8 +536,11 @@ int bcmp(const void *s1, const void *s2,
 	char ch;
 
 	while (len--) {
-		ch = *((char *)s1)++;
-		if ((i = ch - *((char *)s2)++) != 0)
+		ch = *(char *)s1;
+		i = ch - *(char *)s2;
+		s1++;
+		s2++;
+		if (i != 0)
 			return i;
 		if (ch == 0)
 			return 0;
--- a/qemu/system_qemu.c
+++ b/qemu/system_qemu.c
@@ -332,11 +332,18 @@ void *mem_zalloc(struct mem *t, int size
  * Library functions
  */
 void bzero(void *s, int len) {
-	while (len--) *((char *)s)++ = 0;
+	while (len--) {
+		*(char *)s = 0;
+		s++;
+	}
 }
 
 void bcopy(const void *f, void *t, int len) {
-	while (len--) *((char *)t)++ = *((char *)f)++;
+	while (len--) {
+		*(char *)t = *(char *)f;
+		f++;
+		t++;
+	}
 }
 
 /* Comparison is 7-bit */
@@ -346,8 +353,11 @@ int bcmp(const void *s1, const void *s2,
 	char ch;
 
 	while (len--) {
-		ch = *((char *)s1)++;
-		if ((i = ch - *((char *)s2)++) != 0)
+		ch = *(char *)s1;
+		i = ch - *(char *)s2;
+		s1++;
+		s2++;
+		if (i != 0)
 			return i;
 		if (ch == 0)
 			return 0;