[tuxdroid-svn] r1085 - software_suite_v2/middleware/tuxdriver/trunk/src
Status: Beta
Brought to you by:
ks156
From: eFfeM <c2m...@c2...> - 2008-05-03 09:03:26
|
Author: eFfeM Date: 2008-05-03 11:03:27 +0200 (Sat, 03 May 2008) New Revision: 1085 Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_firmware.c Log: rewrote dump_descriptor_of_cpu (improved efficiency & readability) Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_firmware.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_firmware.c 2008-05-02 17:34:18 UTC (rev 1084) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_firmware.c 2008-05-03 09:03:27 UTC (rev 1085) @@ -189,45 +189,34 @@ static void dump_descriptor_of_cpu(char *descriptor, const firmware_descriptor_t *desc) { - char tmp_str[80] = ""; + char *p = descriptor + strlen(descriptor); - sprintf(tmp_str, " CPU id : \t\t\t%d\n", - desc->cpu_id); - strcat(descriptor, tmp_str); - sprintf(tmp_str, " CPU name : \t\t\t%s\n", - cpu_id_to_name(desc->cpu_id)); - strcat(descriptor, tmp_str); - sprintf(tmp_str, " Version major : \t\t%d\n", - desc->version_major); - strcat(descriptor, tmp_str); - sprintf(tmp_str, " Version minor : \t\t%d\n", - desc->version_minor); - strcat(descriptor, tmp_str); - sprintf(tmp_str, " Version update : \t\t%d\n", - desc->version_update); - strcat(descriptor, tmp_str); - sprintf(tmp_str, " Revision : \t\t\t%d\n", - desc->revision); - strcat(descriptor, tmp_str); - sprintf(tmp_str, " Released : \t\t\t%s\n", - desc->release ? "True" : "False"); - strcat(descriptor, tmp_str); - sprintf(tmp_str, " Local modification : \t%s\n", - desc->local_modification ? "True" : "False"); - strcat(descriptor, tmp_str); - sprintf(tmp_str, " Mixed revisions : \t\t%s\n", - desc->mixed_revisions ? "True" : "False"); - strcat(descriptor, tmp_str); - sprintf(tmp_str, " Author id : \t\t%d\n", - desc->author); - strcat(descriptor, tmp_str); - sprintf(tmp_str, " Variation : \t\t%d\n", - desc->variation); - strcat(descriptor, tmp_str); - sprintf(tmp_str, " Symbolic version : \t\t[%s]\n", - desc->version_string); - strcat(descriptor, tmp_str); - + sprintf(p, + " CPU id : \t\t\t%d\n" + " CPU name : \t\t\t%s\n" + " Version major : \t\t%d\n" + " Version minor : \t\t%d\n" + " Version update : \t\t%d\n" + " Revision : \t\t\t%d\n" + " Released : \t\t\t%s\n" + " Local modification : \t%s\n" + " Mixed revisions : \t\t%s\n" + " Author id : \t\t%d\n" + " Variation : \t\t%d\n" + " Symbolic version : \t\t[%s]\n", + desc->cpu_id, + cpu_id_to_name(desc->cpu_id), + desc->version_major, + desc->version_minor, + desc->version_update, + desc->revision, + desc->release ? "True" : "False", + desc->local_modification ? "True" : "False", + desc->mixed_revisions ? "True" : "False", + desc->author, + desc->variation, + desc->version_string + ); return; } |