ares_cancel(): cancel requests safely

An invocation of ares_cancel() walks through the request list, calling
the callbacks of all pending requests on a channel. Previously, if such
a callback added a new request to the channel, the request list might
not end up empty, causing an abort by assertion failure. The present
commit ensures that precisely all requests present upon entry of
ares_cancel() are cancelled, and that adding new requests through
callbacks is safe.
Documentation: properly document ARES_ECANCELLED

This commit clarifies the behaviour of ares_cancel() with respect to
callbacks and adds missing documentation of ARES_ECANCELLED to the man
pages of the affected functions.
ares_destroy() documentation: no new requests

Clarify that no new requests may be added to a resolver channel that is
currently being destroyed.
.gitignore: ignore patch files

This commit adds a line to .gitignore to the effect that patch files
generated by 'git format-patch' are excluded from the repository.
Added -DCARES_STATICLIB to CFLAGS.

Currently this static makefile does only support building the
static library libcares.a.
Create ares_build.h when buidling from Git.
protocol parsing: check input data stricter

... so that bad length fields aren't blindly accepted

Bug: http://c-ares.haxx.se/mail/c-ares-archive-2013-04/0016.shtml