PERFORCE change 121993 for review
Andrew Turner
andrew at FreeBSD.org
Tue Jun 19 21:52:34 UTC 2007
http://perforce.freebsd.org/chv.cgi?CH=121993
Change 121993 by andrew at andrew_hermies on 2007/06/19 21:52:10
Use INT32_{MIN,MAX} and UINT32_MAX rather than magic numbers
Replace snprintf with a const char *
Affected files ...
.. //depot/projects/soc2007/andrew-update/lib/facund_object.c#2 edit
.. //depot/projects/soc2007/andrew-update/lib/facund_server.c#6 edit
Differences ...
==== //depot/projects/soc2007/andrew-update/lib/facund_object.c#2 (text+ko) ====
@@ -324,7 +324,7 @@
int32_t data;
const char *errstr;
- data = strtonum(value, (-0x7fffffff - 1), 0x7fffffff, &errstr);
+ data = strtonum(value, INT32_MIN, INT32_MAX, &errstr);
if (errstr != NULL) {
/* TODO: Error handeling */
return -1;
@@ -335,7 +335,7 @@
uint32_t data;
const char *errstr;
- data = strtonum(value, 0, 0xffffffffU, &errstr);
+ data = strtonum(value, 0, UINT32_MAX, &errstr);
if (errstr != NULL) {
/* TODO: Error handeling */
return -1;
==== //depot/projects/soc2007/andrew-update/lib/facund_server.c#6 (text+ko) ====
@@ -202,7 +202,6 @@
facund_server_end_tag(void *data, const XML_Char *name)
{
struct facund_conn *conn;
- char str[1024];
printf("< %s\n", name);
conn = data;
@@ -223,8 +222,8 @@
conn->call_arg = conn->call_arg->obj_parent;
}
} else if (strcmp(name, "facund-client") == 0) {
- snprintf(str, 1024, "</facund-server>");
- facund_send(conn, str, strlen(str));
+ const char *msg = "</facund-server>";
+ facund_send(conn, msg, strlen(msg));
conn->close = 1;
}
}
More information about the p4-projects
mailing list