Add callback data to for_each_ref() family.

This is a long overdue fix to the API for for_each_ref() family
of functions.  It allows the callers to specify a callback data
pointer, so that the caller does not have to use static
variables to communicate with the callback funciton.

The updated for_each_ref() family takes a function of type

	int (*fn)(const char *, const unsigned char *, void *)

and a void pointer as parameters, and calls the function with
the name of the ref and its SHA-1 with the caller-supplied void
pointer as parameters.

The commit updates two callers, builtin-name-rev.c and
builtin-pack-refs.c as an example.

Signed-off-by: Junio C Hamano <junkio@cox.net>
18 files changed
tree: d64f4ca2150e36ed77e30df9a3c4261028d26ad2
  1. arm/
  2. compat/
  3. contrib/
  4. Documentation/
  5. gitweb/
  6. mozilla-sha1/
  7. ppc/
  8. t/
  9. templates/
  10. xdiff/
  11. .gitignore
  12. alloc.c
  13. archive.h
  14. base85.c
  15. blame.c
  16. blob.c
  17. blob.h
  18. builtin-add.c
  19. builtin-apply.c
  20. builtin-archive.c
  21. builtin-cat-file.c
  22. builtin-check-ref-format.c
  23. builtin-checkout-index.c
  24. builtin-commit-tree.c
  25. builtin-count-objects.c
  26. builtin-diff-files.c
  27. builtin-diff-index.c
  28. builtin-diff-stages.c
  29. builtin-diff-tree.c
  30. builtin-diff.c
  31. builtin-fmt-merge-msg.c
  32. builtin-grep.c
  33. builtin-init-db.c
  34. builtin-log.c
  35. builtin-ls-files.c
  36. builtin-ls-tree.c
  37. builtin-mailinfo.c
  38. builtin-mailsplit.c
  39. builtin-mv.c
  40. builtin-name-rev.c
  41. builtin-pack-objects.c
  42. builtin-pack-refs.c
  43. builtin-prune-packed.c
  44. builtin-prune.c
  45. builtin-push.c
  46. builtin-read-tree.c
  47. builtin-repo-config.c
  48. builtin-rev-list.c
  49. builtin-rev-parse.c
  50. builtin-rm.c
  51. builtin-runstatus.c
  52. builtin-show-branch.c
  53. builtin-stripspace.c
  54. builtin-symbolic-ref.c
  55. builtin-tar-tree.c
  56. builtin-unpack-objects.c
  57. builtin-update-index.c
  58. builtin-update-ref.c
  59. builtin-upload-archive.c
  60. builtin-upload-tar.c
  61. builtin-verify-pack.c
  62. builtin-write-tree.c
  63. builtin-zip-tree.c
  64. builtin.h
  65. cache-tree.c
  66. cache-tree.h
  67. cache.h
  68. check-racy.c
  69. color.c
  70. color.h
  71. combine-diff.c
  72. commit.c
  73. commit.h
  74. config.c
  75. config.mak.in
  76. configure.ac
  77. connect.c
  78. convert-objects.c
  79. copy.c
  80. COPYING
  81. csum-file.c
  82. csum-file.h
  83. ctype.c
  84. daemon.c
  85. date.c
  86. delta.h
  87. describe.c
  88. diff-delta.c
  89. diff-lib.c
  90. diff.c
  91. diff.h
  92. diffcore-break.c
  93. diffcore-delta.c
  94. diffcore-order.c
  95. diffcore-pickaxe.c
  96. diffcore-rename.c
  97. diffcore.h
  98. dir.c
  99. dir.h
  100. dump-cache-tree.c
  101. entry.c
  102. environment.c
  103. exec_cmd.c
  104. exec_cmd.h
  105. fetch-clone.c
  106. fetch-pack.c
  107. fetch.c
  108. fetch.h
  109. fsck-objects.c
  110. generate-cmdlist.sh
  111. git-am.sh
  112. git-annotate.perl
  113. git-applymbox.sh
  114. git-applypatch.sh
  115. git-archimport.perl
  116. git-bisect.sh
  117. git-branch.sh
  118. git-checkout.sh
  119. git-cherry.sh
  120. git-clean.sh
  121. git-clone.sh
  122. git-commit.sh
  123. git-compat-util.h
  124. git-cvsexportcommit.perl
  125. git-cvsimport.perl
  126. git-cvsserver.perl
  127. git-fetch.sh
  128. git-instaweb.sh
  129. git-lost-found.sh
  130. git-ls-remote.sh
  131. git-merge-octopus.sh
  132. git-merge-one-file.sh
  133. git-merge-ours.sh
  134. git-merge-recursive.py
  135. git-merge-resolve.sh
  136. git-merge-stupid.sh
  137. git-merge.sh
  138. git-p4import.py
  139. git-parse-remote.sh
  140. git-pull.sh
  141. git-quiltimport.sh
  142. git-rebase.sh
  143. git-relink.perl
  144. git-repack.sh
  145. git-request-pull.sh
  146. git-rerere.perl
  147. git-reset.sh
  148. git-resolve.sh
  149. git-revert.sh
  150. git-send-email.perl
  151. git-sh-setup.sh
  152. git-shortlog.perl
  153. git-svn.perl
  154. git-svnimport.perl
  155. git-tag.sh
  156. git-verify-tag.sh
  157. GIT-VERSION-GEN
  158. git.c
  159. git.spec.in
  160. gitk
  161. gitMergeCommon.py
  162. hash-object.c
  163. help.c
  164. http-fetch.c
  165. http-push.c
  166. http.c
  167. http.h
  168. ident.c
  169. imap-send.c
  170. index-pack.c
  171. INSTALL
  172. list-objects.c
  173. list-objects.h
  174. local-fetch.c
  175. lockfile.c
  176. log-tree.c
  177. log-tree.h
  178. Makefile
  179. merge-base.c
  180. merge-file.c
  181. merge-index.c
  182. merge-recursive.c
  183. merge-tree.c
  184. mktag.c
  185. mktree.c
  186. object-refs.c
  187. object.c
  188. object.h
  189. pack-check.c
  190. pack-redundant.c
  191. pack.h
  192. pager.c
  193. patch-delta.c
  194. patch-id.c
  195. path-list.c
  196. path-list.h
  197. path.c
  198. peek-remote.c
  199. pkt-line.c
  200. pkt-line.h
  201. quote.c
  202. quote.h
  203. read-cache.c
  204. README
  205. receive-pack.c
  206. refs.c
  207. refs.h
  208. revision.c
  209. revision.h
  210. rsh.c
  211. rsh.h
  212. run-command.c
  213. run-command.h
  214. send-pack.c
  215. server-info.c
  216. setup.c
  217. sha1_file.c
  218. sha1_name.c
  219. shell.c
  220. show-index.c
  221. sideband.c
  222. sideband.h
  223. ssh-fetch.c
  224. ssh-pull.c
  225. ssh-push.c
  226. ssh-upload.c
  227. strbuf.c
  228. strbuf.h
  229. tag.c
  230. tag.h
  231. tar.h
  232. test-date.c
  233. test-delta.c
  234. test-sha1.c
  235. test-sha1.sh
  236. trace.c
  237. tree-diff.c
  238. tree-walk.c
  239. tree-walk.h
  240. tree.c
  241. tree.h
  242. unpack-file.c
  243. unpack-trees.c
  244. unpack-trees.h
  245. update-server-info.c
  246. upload-pack.c
  247. usage.c
  248. var.c
  249. write_or_die.c
  250. wt-status.c
  251. wt-status.h
  252. xdiff-interface.c
  253. xdiff-interface.h