Minor fix for EventCacheLookup()

Started by Amit Langoteover 8 years ago2 messages
#1Amit Langote
Langote_Amit_f8@lab.ntt.co.jp
1 attachment(s)

It should return NIL when no entry is found in the cache, not NULL.

Attached patch fixes that.

Thanks,
Amit

Attachments:

EventCacheLookup-return-NIL.patchtext/plain; charset=UTF-8; name=EventCacheLookup-return-NIL.patchDownload
diff --git a/src/backend/utils/cache/evtcache.c b/src/backend/utils/cache/evtcache.c
index 54ddc55f76..6faf4ae354 100644
--- a/src/backend/utils/cache/evtcache.c
+++ b/src/backend/utils/cache/evtcache.c
@@ -68,7 +68,7 @@ EventCacheLookup(EventTriggerEvent event)
 	if (EventTriggerCacheState != ETCS_VALID)
 		BuildEventTriggerCache();
 	entry = hash_search(EventTriggerCache, &event, HASH_FIND, NULL);
-	return entry != NULL ? entry->triggerlist : NULL;
+	return entry != NULL ? entry->triggerlist : NIL;
 }
 
 /*
#2Robert Haas
robertmhaas@gmail.com
In reply to: Amit Langote (#1)
Re: Minor fix for EventCacheLookup()

On Tue, Jun 6, 2017 at 12:24 AM, Amit Langote
<Langote_Amit_f8@lab.ntt.co.jp> wrote:

It should return NIL when no entry is found in the cache, not NULL.

Attached patch fixes that.

I'm not sure how much value neatnik-ism has in cases like this, but committed.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers