- buf = parse_common(db->fp, db, name, db_and_field_pos & 3);
- if (buf) {
- free(db->malloced);
- /* We enlarge buf and move string data up, freeing space
- * for struct passwd/group/spwd at the beginning. This way,
- * entire result of getXXnam is in a single malloced block.
- * This enables easy creation of xmalloc_getpwnam() API.
- */
- db->malloced = buf = xrealloc(buf, db->size_of + S.string_size);
- memmove(buf + db->size_of, buf, S.string_size);
- result = convert_to_struct(db, buf + db->size_of, buf);
- }
- return result;
+ buf = parse_common(db->fp, db, /*no search key:*/ NULL, -1);
+ return massage_data_for_non_r_func(db, buf);
+}
+
+struct passwd* FAST_FUNC getpwent(void)
+{
+ return getXXent(0);
+}
+
+/****** getXXnam/id */
+
+static void* FAST_FUNC getXXnam(const char *name, unsigned db_and_field_pos)
+{
+ char *buf;
+ struct passdb *db = &get_S()->db[db_and_field_pos >> 2];
+
+ buf = parse_file(db, name, db_and_field_pos & 3);
+ return massage_data_for_non_r_func(db, buf);