[patch]: simplify a_Html_form_event_handler()
The a_Html_form_event_handler() function displays an amusing anti-pattern (which I wish I knew the name of) where it's not given enough data and has to go searching for the missing information. Specifically, it gets a pointer to the DilloHtml of the page, but not not the DilloHtmlForm that submitted it, so it has to search the form list of the DilloHtml to find the form. This patch passes the DilloHtmlForm to the handler and adds a pointer from the DilloHtmlForm to the DilloHtml , so the handler can now directly access the form and the html without messing around. Regards, Jeremy Henty
More simplification of form handling. Several functions that used an index to an input in the form's input list have been changed to use a pointer to the input, which removed some useless indirection. This enabled refactoring the code in a_Html_form_event_handler() that found the input from the resource into a new method "DilloHtmlInput *DilloHtmlForm::getInput (void *v_resource)". Regards, Jeremy Henty
On Thu, May 29, 2008 at 07:38:26PM +0100, Jeremy Henty wrote:
More simplification of form handling. Several functions that used an index to an input in the form's input list have been changed to use a pointer to the input, which removed some useless indirection. This enabled refactoring the code in a_Html_form_event_handler() that found the input from the resource into a new method "DilloHtmlInput *DilloHtmlForm::getInput (void *v_resource)".
Committed. -- Cheers Jorge.-
On Thu, May 29, 2008 at 05:54:57PM +0100, Jeremy Henty wrote:
The a_Html_form_event_handler() function displays an amusing anti-pattern (which I wish I knew the name of) where it's not given enough data and has to go searching for the missing information. Specifically, it gets a pointer to the DilloHtml of the page, but not not the DilloHtmlForm that submitted it, so it has to search the form list of the DilloHtml to find the form.
This patch passes the DilloHtmlForm to the handler and adds a pointer from the DilloHtmlForm to the DilloHtml , so the handler can now directly access the form and the html without messing around.
Committed. -- Cheers Jorge.-
participants (2)
-
jcid@dillo.org
-
onepoint@starurchin.org