Thread (234 messages) flat view 234 messages, 5 authors, 2017-04-07

Re: [PATCH v5 09/24] refs.c: introduce get_main_ref_store()

From: Duy Nguyen <hidden>
Date: 2017-03-01 12:07:52

On Wed, Mar 1, 2017 at 12:51 AM, Michael Haggerty [off-list ref] wrote:
On 02/22/2017 03:04 PM, Nguyễn Thái Ngọc Duy wrote:
quoted
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
---
 refs.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/refs.c b/refs.c
index 81b64b4ed..dab1a21ac 100644
--- a/refs.c
+++ b/refs.c
@@ -1456,15 +1456,23 @@ static struct ref_store *ref_store_init(const char *submodule)
      return refs;
 }

+static struct ref_store *get_main_ref_store(void)
+{
+     struct ref_store *refs;
+
+     if (main_ref_store)
+             return main_ref_store;
+
+     refs = ref_store_init(NULL);
+     return refs;
Unnecessary temporary variable?
That's the price for doing too much mechanical conversion :-P On
second read, I think I did that on purpose (or by luck) because the
"kill register_ref_store" patch needs this intermediate "refs" so we
can save it to main_ref_store. Cleaner future patch for the minor
uncleanliness in the current one.
-- 
Duy
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help