Added getmappingsize(). (Needed by previous checkin of posixmodule.c)

This commit is contained in:
Guido van Rossum 1993-11-05 10:18:44 +00:00
parent 32be3a7a88
commit 4199facacd
3 changed files with 23 additions and 0 deletions

View File

@ -44,6 +44,7 @@ extern int mappinggetnext
extern object *getmappingkeys PROTO((object *mp));
extern object *getmappingvalues PROTO((object *mp));
extern object *getmappingitems PROTO((object *mp));
extern int getmappingsize PROTO((object *mp));
#ifdef __cplusplus
}

View File

@ -566,6 +566,17 @@ mapping_items(mp, args)
return v;
}
int
getmappingsize(mp)
object *mp;
{
if (mp == NULL || !is_mappingobject(mp)) {
err_badcall();
return NULL;
}
return ((mappingobject *)mp)->ma_used;
}
object *
getmappingkeys(mp)
object *mp;

View File

@ -566,6 +566,17 @@ mapping_items(mp, args)
return v;
}
int
getmappingsize(mp)
object *mp;
{
if (mp == NULL || !is_mappingobject(mp)) {
err_badcall();
return NULL;
}
return ((mappingobject *)mp)->ma_used;
}
object *
getmappingkeys(mp)
object *mp;