svn commit: r345998 - head/stand/common

2019-09-03 Thread Toomas Soome
Author: tsoome
Date: Sun Apr  7 11:48:41 2019
New Revision: 345998
URL: https://svnweb.freebsd.org/changeset/base/345998

Log:
  loader: malloc+bzero is calloc
  
  Replace malloc+bzero in module.c with calloc.
  
  MFC after:1w

Modified:
  head/stand/common/module.c

Modified: head/stand/common/module.c
==
--- head/stand/common/module.c  Sun Apr  7 08:58:09 2019(r345997)
+++ head/stand/common/module.c  Sun Apr  7 11:48:41 2019(r345998)
@@ -926,10 +926,9 @@ file_addmodule(struct preloaded_file *fp, char *modnam
mp = file_findmodule(fp, modname, );
if (mp)
return (EEXIST);
-   mp = malloc(sizeof(struct kernel_module));
+   mp = calloc(1, sizeof(struct kernel_module));
if (mp == NULL)
return (ENOMEM);
-   bzero(mp, sizeof(struct kernel_module));
mp->m_name = strdup(modname);
mp->m_version = version;
mp->m_fp = fp;
@@ -980,12 +979,8 @@ file_discard(struct preloaded_file *fp)
 struct preloaded_file *
 file_alloc(void)
 {
-   struct preloaded_file   *fp;
 
-   if ((fp = malloc(sizeof(struct preloaded_file))) != NULL) {
-   bzero(fp, sizeof(struct preloaded_file));
-   }
-   return (fp);
+   return (calloc(1, sizeof(struct preloaded_file)));
 }
 
 /*


___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r345998 - head/stand/common

2019-04-07 Thread Toomas Soome
Author: tsoome
Date: Sun Apr  7 11:48:41 2019
New Revision: 345998
URL: https://svnweb.freebsd.org/changeset/base/345998

Log:
  loader: malloc+bzero is calloc
  
  Replace malloc+bzero in module.c with calloc.
  
  MFC after:1w

Modified:
  head/stand/common/module.c

Modified: head/stand/common/module.c
==
--- head/stand/common/module.c  Sun Apr  7 08:58:09 2019(r345997)
+++ head/stand/common/module.c  Sun Apr  7 11:48:41 2019(r345998)
@@ -926,10 +926,9 @@ file_addmodule(struct preloaded_file *fp, char *modnam
mp = file_findmodule(fp, modname, );
if (mp)
return (EEXIST);
-   mp = malloc(sizeof(struct kernel_module));
+   mp = calloc(1, sizeof(struct kernel_module));
if (mp == NULL)
return (ENOMEM);
-   bzero(mp, sizeof(struct kernel_module));
mp->m_name = strdup(modname);
mp->m_version = version;
mp->m_fp = fp;
@@ -980,12 +979,8 @@ file_discard(struct preloaded_file *fp)
 struct preloaded_file *
 file_alloc(void)
 {
-   struct preloaded_file   *fp;
 
-   if ((fp = malloc(sizeof(struct preloaded_file))) != NULL) {
-   bzero(fp, sizeof(struct preloaded_file));
-   }
-   return (fp);
+   return (calloc(1, sizeof(struct preloaded_file)));
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"