+/* Remove the specified key. If 'deleted' is not NULL the pointed integer is
+ * set to 0 if the key was not found, to 1 if it was found and deleted. */
+unsigned char *zipmapDel(unsigned char *zm, unsigned char *key, unsigned int klen, int *deleted) {
+ unsigned char *p = zipmapLookupRaw(zm,key,klen,NULL,NULL,NULL);
+ if (p) {
+ unsigned int freelen = zipmapRawEntryLength(p);
+
+ p[0] = ZIPMAP_EMPTY;
+ zipmapEncodeLength(p+1,freelen);
+ zm[0] |= ZIPMAP_STATUS_FRAGMENTED;
+ if (deleted) *deleted = 1;
+ } else {
+ if (deleted) *deleted = 0;
+ }
+ return zm;
+}
+