Tidy lib: Changing an attribute value (patch included)

	hi, here is a quick patch to allow one to
change an attribute's value when using the tidylib,
it basically adds:

void tidyAttrValueSet ( TidyAttr tattr, ctmbstr* val );

example:

	[...]
        if (!strcmp ( tidyAttrName ( attribute ), "value" ))
          tidyAttrValueSet ( attribute, tmbstrdup ( "foo" ));
	[...]

	best regards,

/olivier
--- tidy/src/tidylib.c.orig	Thu Oct  9 12:58:03 2003
+++ tidy/src/tidylib.c	Thu Oct  9 13:06:08 2003
@@ -1548,6 +1548,16 @@
     aval = attval->value;
   return aval;
 }
+void       tidyAttrValueSet( TidyAttr tattr, ctmbstr* val )
+{
+  AttVal* attval = tidyAttrToImpl( tattr );
+  ctmbstr aval = NULL;
+  if ( attval ) {
+    if ( attval->value )
+      free ( attval->value );
+    attval->value = tmbstrdup ( val );
+  }
+}
 
 /* Null for pure HTML
 ctmbstr       tidyAttrNsLocal( TidyAttr tattr )

Received on Thursday, 9 October 2003 07:42:03 UTC