function, use Amd's CALLOC(struct FOO) macro.
* amd/sun_map.h: remove extern definitions to functions no longer
needed.
* amd/sun_map.c: removed superfluous *_alloc() functions, some of
which caused conflicts with same-named symbols in the parser
(since we rename 'yyalloc' to 'sun_map_alloc').
2005-08-11 Erez Zadok <ezk@cs.sunysb.edu>
+ * amd/sun_map_parse.y: instead of using a custom FOO_alloc()
+ function, use Amd's CALLOC(struct FOO) macro.
+
+ * amd/sun_map.h: remove extern definitions to functions no longer
+ needed.
+
+ * amd/sun_map.c: removed superfluous *_alloc() functions, some of
+ which caused conflicts with same-named symbols in the parser
+ (since we rename 'yyalloc' to 'sun_map_alloc').
+
* configure.in: keep AC_INIT on same line, for nightly snapshot
build script.
#include <sun_map.h>
-/*
- * Allocate a sun_mmap struct.
- *
- * return - sun_amap* on success, NULL no memory
- */
-struct sun_mmap *
-sun_mmap_alloc(void)
-{
- struct sun_mmap *retval;
-
- retval = (struct sun_mmap *) xmalloc(sizeof(struct sun_mmap));
- memset(retval, 0, sizeof(struct sun_mmap));
-
- return retval;
-}
-
-
-/*
- * Allocate a sun_map struct.
- *
- * return - sun_map* on success, NULL no memory
- */
-struct sun_map *
-sun_map_alloc(void)
-{
- struct sun_map *retval;
-
- retval = (struct sun_map *) xmalloc(sizeof(struct sun_map));
- memset(retval, 0, sizeof(struct sun_map));
-
- return retval;
-}
-
-
-/*
- * Allocate a sun_entry struct.
- *
- * return - sun_entry* on success, NULL no memory
- */
-struct sun_entry *
-sun_entry_alloc(void)
-{
- struct sun_entry *retval;
-
- retval = (struct sun_entry *) xmalloc(sizeof(struct sun_entry));
- memset(retval, 0, sizeof(struct sun_entry));
-
- return retval;
-}
-
-
-/*
- * Allocate a sun_mountpt
- *
- * return - sun_mountpt* on success, NULL no memory
- */
-struct sun_mountpt *
-sun_mountpt_alloc(void)
-{
- struct sun_mountpt *retval;
-
- retval = (struct sun_mountpt *) xmalloc(sizeof(struct sun_mountpt));
- memset(retval, 0, sizeof(struct sun_mountpt));
-
- return retval;
-}
-
-
-/*
- * Allocate a sun_location struct.
- *
- * return sun_location* on sucess, NULL no memory
- */
-struct sun_location *
-sun_location_alloc(void)
-{
- struct sun_location *retval;
-
- retval = (struct sun_location *) xmalloc(sizeof(struct sun_location));
- memset(retval, 0, sizeof(struct sun_location));
-
- return retval;
-}
-
-
-/*
- * Allocate a sun_host struct.
- *
- * return sun_host* on sucess, NULL no memory
- */
-struct sun_host *
-sun_host_alloc(void)
-{
- struct sun_host *retval;
- retval = (struct sun_host *) xmalloc(sizeof(struct sun_host));
-
- memset(retval, 0, sizeof(struct sun_host));
-
- return retval;
-}
-
-
-/*
- * Allocate a sun_opt struct.
- *
- * return sun_opt* on sucess, NULL no memory
- */
-struct sun_opt *
-sun_opt_alloc(void)
-{
- struct sun_opt *retval;
-
- retval = (struct sun_opt *) xmalloc(sizeof(struct sun_opt));
- memset(retval, 0, sizeof(struct sun_opt));
-
- return retval;
-}
-
-
-/*
- * Allocate a sun_list struct.
- *
- * return sun_list* on sucess, NULL no memory
- */
-struct sun_list *
-sun_list_alloc(void)
-{
- struct sun_list *retval;
-
- retval = (struct sun_list *) xmalloc(sizeof(struct sun_list));
- memset(retval, 0, sizeof(struct sun_list));
-
- return retval;
-}
-
/*
* Add a data pointer to the end of the list.
}
}
else {
- plog(XLOG_INFO,"No SUN fstype specified defaulting to NFS.");
+ plog(XLOG_INFO, "No SUN fstype specified defaulting to NFS.");
}
* EXTERNS
*/
extern char *sun_entry2amd(const char *);
-extern struct sun_entry *sun_entry_alloc(void);
extern struct sun_entry *sun_map_parse_read(const char *);
-extern struct sun_host *sun_host_alloc(void);
-extern struct sun_list *sun_list_alloc(void);
-extern struct sun_location *sun_location_alloc(void);
-extern struct sun_map *sun_map_alloc(void);
-extern struct sun_mmap *sun_mmap_alloc(void);
-extern struct sun_mountpt *sun_mountpt_alloc(void);
-extern struct sun_opt *sun_opt_alloc(void);
extern void sun_list_add(struct sun_list *, qelem *);
#endif /* not _SUN_MAP_H */
struct sun_entry *entry;
/* allocate an entry */
- entry = sun_entry_alloc();
+ entry = CALLOC(struct sun_entry);
/*
* Assign the global location list to this entry and reset the
struct sun_list *list;
struct sun_entry *entry;
- entry = sun_entry_alloc();
+ entry = CALLOC(struct sun_entry);
/* An fstype may have been defined in the 'options'. */
if(tmpFsType != NULL) {
struct sun_entry *entry;
/* allocate an entry */
- entry = sun_entry_alloc();
+ entry = CALLOC(struct sun_entry);
/*
* Assign the global mountpt list to this entry and reset the global
struct sun_entry *entry;
/* allocate an entry */
- entry = sun_entry_alloc();
+ entry = CALLOC(struct sun_entry);
/* An fstype may have been defined in the 'options'. */
if(tmpFsType != NULL) {
| '+' WORD {
- struct sun_opt *include = sun_opt_alloc();
+ struct sun_opt *include = CALLOC(struct sun_opt);
include->str = strdup($2);
sun_list_add(get_sun_include_list(),(qelem *)include);
struct sun_mountpt *mountpt;
/* allocate a mountpt */
- mountpt = sun_mountpt_alloc();
+ mountpt = CALLOC(struct sun_mountpt);
/*
* Assign the global loaction list to this entry and reset the
struct sun_mountpt *mountpt;
/* allocate a mountpt */
- mountpt = sun_mountpt_alloc();
+ mountpt = CALLOC(struct sun_mountpt);
/*
* Assign the global loaction list to this entry and reset the
struct sun_location *location;
/* allocate a new location */
- location = sun_location_alloc();
+ location = CALLOC(struct sun_location);
/*
* Assign the global opt list to this entry and reset the global
struct sun_location *location;
/* allocate a new location */
- location = sun_location_alloc();
+ location = CALLOC(struct sun_location);
location->path = strdup($2);
host : WORD {
/* allocate a new host */
- struct sun_host *host = sun_host_alloc();
+ struct sun_host *host = CALLOC(struct sun_host);
host->name = strdup($1);
int val;
/* allocate a new host */
- struct sun_host *host = sun_host_alloc();
+ struct sun_host *host = CALLOC(struct sun_host);
val = atoi($2);
/* all other fs options */
| WORD {
- struct sun_opt *opt = sun_opt_alloc();
+ struct sun_opt *opt = CALLOC(struct sun_opt);
opt->str = strdup($1);
/* Add this opt to the opt list. */
get_sun_include_list(void)
{
if (sun_include_list == NULL) {
- sun_include_list = sun_list_alloc();
+ sun_include_list = CALLOC(struct sun_list);
}
return sun_include_list;
}
get_sun_entry_list(void)
{
if (sun_entry_list == NULL) {
- sun_entry_list = sun_list_alloc();
+ sun_entry_list = CALLOC(struct sun_list);
}
return sun_entry_list;
}
get_mountpt_list(void)
{
if (mountpt_list == NULL) {
- mountpt_list = sun_list_alloc();
+ mountpt_list = CALLOC(struct sun_list);
}
return mountpt_list;
}
get_sun_location_list(void)
{
if (sun_location_list == NULL) {
- sun_location_list = sun_list_alloc();
+ sun_location_list = CALLOC(struct sun_list);
}
return sun_location_list;
}
get_sun_host_list(void)
{
if (sun_host_list == NULL) {
- sun_host_list = sun_list_alloc();
+ sun_host_list = CALLOC(struct sun_list);
}
return sun_host_list;
}
get_sun_opt_list(void)
{
if (sun_opt_list == NULL) {
- sun_opt_list = sun_list_alloc();
+ sun_opt_list = CALLOC(struct sun_list);
}
return sun_opt_list;
}