+ if (de == NULL) return -1;
+ *objval = dictGetEntryVal(de);
+ }
+ return o->encoding;
+}
+
+/* Higher level function of hashTypeGet() that always returns a Redis
+ * object (either new or with refcount incremented), so that the caller
+ * can retain a reference or call decrRefCount after the usage.
+ *
+ * The lower level function can prevent copy on write so it is
+ * the preferred way of doing read operations. */
+robj *hashTypeGetObject(robj *o, robj *key) {
+ robj *objval;
+ unsigned char *v;
+ unsigned int vlen;
+
+ int encoding = hashTypeGet(o,key,&objval,&v,&vlen);
+ switch(encoding) {
+ case REDIS_ENCODING_HT:
+ incrRefCount(objval);
+ return objval;
+ case REDIS_ENCODING_ZIPMAP:
+ objval = createStringObject((char*)v,vlen);
+ return objval;
+ default: return NULL;