git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "R. Tyler Ballance" <tyler@slide.com>
To: git@vger.kernel.org
Cc: "R. Tyler Ballance" <tyler@slide.com>
Subject: [PATCH] Style changes per suggestions from Junio in #git
Date: Sun, 21 Dec 2008 15:37:34 -0600	[thread overview]
Message-ID: <1229895454-19498-3-git-send-email-tyler@slide.com> (raw)
In-Reply-To: <1229895454-19498-2-git-send-email-tyler@slide.com>

Moving includes into git-compat-util.h, move away from malloc(2)

Signed-off-by: R. Tyler Ballance <tyler@slide.com>
---
 environment.c     |    9 +++------
 git-compat-util.h |    2 ++
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/environment.c b/environment.c
index a3b6bab..aa36360 100644
--- a/environment.c
+++ b/environment.c
@@ -7,8 +7,6 @@
  * even if you might want to know where the git directory etc
  * are.
  */
-#include <sys/time.h>
-#include <sys/resource.h>
 
 #include "cache.h"
 
@@ -80,10 +78,9 @@ static void setup_git_env(void)
 		git_graft_file = git_pathdup("info/grafts");
 	
 	if (DYNAMIC_WINDOW_SIZE) {
-		struct rlimit *as = malloc(sizeof(struct rlimit));
-		if ( (getrlimit(RLIMIT_AS, as) == 0) && ((int)(as->rlim_cur) > 0) ) 
-			packed_git_window_size = (unsigned int)(as->rlim_cur * DYNAMIC_WINDOW_SIZE_PERCENTAGE);
-		free(as);
+		struct rlimit as;
+		if (getrlimit(RLIMIT_AS, &as) == 0 && (int)as.rlim_cur > 0)
+			packed_git_window_size = (unsigned int)(as.rlim_cur * DYNAMIC_WINDOW_SIZE_PERCENTAGE);
 	}
 }
 
diff --git a/git-compat-util.h b/git-compat-util.h
index 9603ca6..dad2dc8 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -188,6 +188,8 @@ extern int git_munmap(void *start, size_t length);
 #else /* NO_MMAP */
 
 #include <sys/mman.h>
+#include <sys/time.h>
+#include <sys/resource.h>
 
 /* This value must be multiple of (pagesize * 2) */
 #define DEFAULT_PACKED_GIT_WINDOW_SIZE \
-- 

  reply	other threads:[~2008-12-21 21:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-21 21:37 Dynamically adjusting packed_git_window_size R. Tyler Ballance
2008-12-21 21:37 ` [PATCH] Add support for changing packed_git_window_size at process start time R. Tyler Ballance
2008-12-21 21:37   ` R. Tyler Ballance [this message]
2008-12-21 22:03     ` [PATCH] Style changes per suggestions from Junio in #git Matthieu Moy
2008-12-21 22:22     ` Shawn O. Pearce
2008-12-21 22:28   ` [PATCH] Add support for changing packed_git_window_size at process start time Shawn O. Pearce
2008-12-22  6:25     ` R. Tyler Ballance
2008-12-26 21:36       ` Shawn O. Pearce

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1229895454-19498-3-git-send-email-tyler@slide.com \
    --to=tyler@slide.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).