Bug 711799 - Fix a few implicit-declaration warnings in trace-malloc. r=dbaron
authorJeff Walden <jwalden@mit.edu>
Sat, 17 Dec 2011 22:56:55 -0500
changeset 83003 bcc6c2a1da8bae3da24afb7b267caedb051a9948
parent 83002 4f9e7c73feca77c4f43b31b6bb5e97413c7e4021
child 83004 857f872e4d7d5acb2ec4eaf2be69614b0cb23cc9
push id4219
push userjwalden@mit.edu
push dateMon, 19 Dec 2011 22:05:51 +0000
treeherdermozilla-inbound@bcc6c2a1da8b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs711799
milestone11.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 711799 - Fix a few implicit-declaration warnings in trace-malloc. r=dbaron
tools/trace-malloc/lib/nsTraceMalloc.c
tools/trace-malloc/lib/nsTypeInfo.cpp
tools/trace-malloc/lib/nsTypeInfo.h
tools/trace-malloc/spacetrace.c
--- a/tools/trace-malloc/lib/nsTraceMalloc.c
+++ b/tools/trace-malloc/lib/nsTraceMalloc.c
@@ -63,16 +63,17 @@
 #include "prnetdb.h"
 #include "nsTraceMalloc.h"
 #include "nscore.h"
 #include "prinit.h"
 #include "prthread.h"
 #include "plstr.h"
 #include "nsStackWalk.h"
 #include "nsTraceMallocCallbacks.h"
+#include "nsTypeInfo.h"
 
 #if defined(XP_MACOSX)
 
 #include <malloc/malloc.h>
 
 #define WRITE_FLAGS "w"
 
 #define __libc_malloc(x)                malloc(x)
@@ -1745,17 +1746,16 @@ print_stack(FILE *ofp, callsite *site)
 
 static PRIntn
 allocation_enumerator(PLHashEntry *he, PRIntn i, void *arg)
 {
     allocation *alloc = (allocation*) he;
     FILE *ofp = (FILE*) arg;
     callsite *site = (callsite*) he->value;
 
-    extern const char* nsGetTypeName(const void* ptr);
     unsigned long *p, *end;
 
     fprintf(ofp, "%p <%s> (%lu)\n",
             he->key,
             nsGetTypeName(he->key),
             (unsigned long) alloc->size);
 
     for (p   = (unsigned long*) he->key,
--- a/tools/trace-malloc/lib/nsTypeInfo.cpp
+++ b/tools/trace-malloc/lib/nsTypeInfo.cpp
@@ -47,17 +47,17 @@
   use C++ RTTI's typeid operation to obtain the name of the type.
   
   by Patrick C. Beard.
  */
 
 #include <typeinfo>
 #include <ctype.h>
 
-extern "C" const char* nsGetTypeName(void* ptr);
+#include "nsTypeInfo.h"
 
 extern "C" void NS_TraceMallocShutdown();
 
 struct TraceMallocShutdown {
     TraceMallocShutdown() {}
     ~TraceMallocShutdown() {
         NS_TraceMallocShutdown();
     }
new file mode 100644
--- /dev/null
+++ b/tools/trace-malloc/lib/nsTypeInfo.h
@@ -0,0 +1,52 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * the Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2011
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#ifndef trace_malloc_nsTypeInfo_h_
+#define trace_malloc_nsTypeInfo_h_
+
+#include "prtypes.h"
+
+PR_BEGIN_EXTERN_C
+
+extern const char* nsGetTypeName(void* ptr);
+
+extern void RegisterTraceMallocShutdown();
+
+PR_END_EXTERN_C
+
+#endif /* trace_malloc_nsTypeInfo_h_ */
--- a/tools/trace-malloc/spacetrace.c
+++ b/tools/trace-malloc/spacetrace.c
@@ -1915,17 +1915,17 @@ static const char spinner_chars[] = { '/
 
 #define SPINNER_UPDATE_FREQUENCY 4096
 #define SPINNER_CHAR_COUNT (sizeof(spinner_chars) / sizeof(spinner_chars[0]))
 #define SPINNER_CHAR(_x) spinner_chars[(_x / SPINNER_UPDATE_FREQUENCY) % SPINNER_CHAR_COUNT]
 
 void
 tmEventHandler(tmreader * aReader, tmevent * aEvent)
 {
-    static event_count = 0;     /* for spinner */
+    static int event_count = 0;     /* for spinner */
     if ((event_count++ % SPINNER_UPDATE_FREQUENCY) == 0)
         printf("\rReading... %c", SPINNER_CHAR(event_count));
     
     if (NULL != aReader && NULL != aEvent) {
         switch (aEvent->type) {
             /*
              ** Events we ignore.
              */