improve the speed of gpio_set_valuea by using fputc instead of fprintf
the overhead of fputc is less as no format string needs to be scanned
and processed. Also used value + '0' so no conversion is needed

Signed-off-by: Frans Meulenbroeks <[email protected]>
---
 urjtag/src/tap/cable/gpio.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/urjtag/src/tap/cable/gpio.c b/urjtag/src/tap/cable/gpio.c
index 02472a1..6be232b 100644
--- a/urjtag/src/tap/cable/gpio.c
+++ b/urjtag/src/tap/cable/gpio.c
@@ -117,8 +117,8 @@ static int gpio_set_value (FILE *fp, int value)
 {
     int ret;
 
-    ret = fprintf (fp, "%u", value ? 1 : 0);
-    if (ret != 1)
+    ret = fputc(value + '0', fp);
+    if (ret < 0)
     {
         urj_warning (_("Error setting value gpio\n"));
         return URJ_STATUS_FAIL;
-- 
1.7.0.4


------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
UrJTAG-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/urjtag-development

Reply via email to