+ rc = value_add( &(*a)->a_vals, vals );
+
+#ifdef SLAP_NVALUES
+ if( !rc && nvals ) rc = value_add( &(*a)->a_nvals, nvals );
+ else (*a)->a_nvals = (*a)->a_vals;
+#endif
+
+ return rc;
+}
+
+int
+attr_merge_one(
+ Entry *e,
+ AttributeDescription *desc,
+ struct berval *val
+#ifdef SLAP_NVALUES
+ , struct berval *nval
+#endif
+) {
+ int rc;
+ Attribute **a;
+
+ for ( a = &e->e_attrs; *a != NULL; a = &(*a)->a_next ) {
+ if ( ad_cmp( (*a)->a_desc, desc ) == 0 ) {
+ break;
+ }
+ }
+
+ if ( *a == NULL ) {
+ *a = (Attribute *) ch_malloc( sizeof(Attribute) );
+ (*a)->a_desc = desc;
+ (*a)->a_vals = NULL;
+#ifdef SLAP_NVALUES
+ (*a)->a_nvals = NULL;
+#endif
+ (*a)->a_next = NULL;
+ (*a)->a_flags = 0;
+ }
+
+ rc = value_add_one( &(*a)->a_vals, val );
+
+#ifdef SLAP_NVALUES
+ if( !rc && nval ) rc = value_add_one( &(*a)->a_nvals, nval );
+ else (*a)->a_nvals = (*a)->a_vals;
+#endif
+ return rc;