]> git.ipfire.org Git - thirdparty/git.git/commit - http-push.c
http-push: refactor lock-related headers creation for curl requests
authorRay Chuan <rctay89@gmail.com>
Sat, 24 Jan 2009 02:00:22 +0000 (10:00 +0800)
committerJunio C Hamano <gitster@pobox.com>
Sat, 24 Jan 2009 05:50:37 +0000 (21:50 -0800)
commitb1c7d4aafeda8e6b2bbeac29a3181cbe970b7874
tree7c0a50da32ecee1de544b5cbf426a0032c401136
parentb80da424a13107c239ed40573fae3d692d19b6cd
http-push: refactor lock-related headers creation for curl requests

DAV-related headers (more specifically, headers related to the lock token,
namely, If, Lock-Token, and Timeout) for curl requests are created and
allocated individually, eg a "if_header" variable for the "If: " header, a
"timeout_header" variable for the "Timeout: " header.

This patch provides a new function ("get_dav_token_headers") that creates
these header, saving methods from allocating memory, and from issuing a
"curl_slist_append()" call.  The temporary string storage given to
curl_slist_append() is freed much earlier than the previous code with this
patch, but this change is safe, because curl_slist_append() keeps a copy
of the given string.

In part, this patch also addresses the fact that commit 753bc91 (Remove
the requirement opaquelocktoken uri scheme) did not update memory
allocations for DAV-related headers.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
http-push.c