android/utils/: Proper C++ inclusion guards.
This patch ensures that all headers under android/utils/ have proper
C++ inclusion guards, by using "android/utils/compiler.h" and the
macros it defines (ANDROID_BEGIN_HEADER / ANDROID_END_HEADER).
Just general cleanup before further work.
Change-Id: If37e346a1846af43bfd01dd7fc6999e188a6d025
diff --git a/android/utils/bufprint.h b/android/utils/bufprint.h
index b2407b2..e652bb9 100644
--- a/android/utils/bufprint.h
+++ b/android/utils/bufprint.h
@@ -15,9 +15,9 @@
#include <stdarg.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
+#include "android/utils/compiler.h"
+
+ANDROID_BEGIN_HEADER
/** FORMATTED BUFFER PRINTING
**
@@ -77,8 +77,6 @@
extern char* bufprint_temp_dir (char* buffer, char* buffend);
extern char* bufprint_temp_file (char* buffer, char* buffend, const char* suffix);
-#ifdef __cplusplus
-}
-#endif
+ANDROID_END_HEADER
#endif /* _ANDROID_UTILS_BUFPRINT_H */
diff --git a/android/utils/debug.h b/android/utils/debug.h
index 83b4188..af3718d 100644
--- a/android/utils/debug.h
+++ b/android/utils/debug.h
@@ -14,6 +14,10 @@
#include <stdarg.h>
+#include "android/utils/compiler.h"
+
+ANDROID_BEGIN_HEADER
+
#define VERBOSE_TAG_LIST \
_VERBOSE_TAG(init, "emulator initialization") \
_VERBOSE_TAG(console, "control console") \
@@ -99,6 +103,6 @@
extern void stdio_disable( void );
extern void stdio_enable( void );
-/* */
+ANDROID_END_HEADER
#endif /* _ANDROID_UTILS_DEBUG_H */
diff --git a/android/utils/dirscanner.h b/android/utils/dirscanner.h
index 871b05e..c8caff9 100644
--- a/android/utils/dirscanner.h
+++ b/android/utils/dirscanner.h
@@ -12,6 +12,10 @@
#ifndef _ANDROID_UTILS_DIR_H
#define _ANDROID_UTILS_DIR_H
+#include "android/utils/compiler.h"
+
+ANDROID_BEGIN_HEADER
+
/* simple utility to parse directories for files */
/* needed because Unix and Windows don't use the same stuff */
@@ -46,6 +50,6 @@
*/
const char* dirScanner_nextFull( DirScanner* s );
-/* */
+ANDROID_END_HEADER
#endif /* _ANDROID_UTILS_DIR_H */
diff --git a/android/utils/dll.h b/android/utils/dll.h
index 66f3a6d..acd3f87 100644
--- a/android/utils/dll.h
+++ b/android/utils/dll.h
@@ -12,6 +12,10 @@
#ifndef ANDROID_UTILS_DLL_H
#define ANDROID_UTILS_DLL_H
+#include "android/utils/compiler.h"
+
+ANDROID_BEGIN_HEADER
+
/* Opaque type to model a dynamic library handle */
typedef struct ADynamicLibrary ADynamicLibrary;
@@ -41,4 +45,6 @@
/* Close/unload a given dynamic library */
void adynamicLibrary_close( ADynamicLibrary* lib );
+ANDROID_END_HEADER
+
#endif /* ANDROID_UTILS_DLL_H */
diff --git a/android/utils/filelock.h b/android/utils/filelock.h
index 9bc86b5..8ada81a 100644
--- a/android/utils/filelock.h
+++ b/android/utils/filelock.h
@@ -13,6 +13,10 @@
#ifndef _ANDROID_UTILS_FILELOCK_H
#define _ANDROID_UTILS_FILELOCK_H
+#include "android/utils/compiler.h"
+
+ANDROID_BEGIN_HEADER
+
/** FILE LOCKS SUPPORT
**
** a FileLock is useful to prevent several emulator instances from using the same
@@ -35,4 +39,6 @@
extern FileLock* filelock_create ( const char* path );
extern void filelock_release( FileLock* lock );
+ANDROID_END_HEADER
+
#endif /* _ANDROID_UTILS_FILELOCK_H */
diff --git a/android/utils/ini.h b/android/utils/ini.h
index fd56575..08bee97 100644
--- a/android/utils/ini.h
+++ b/android/utils/ini.h
@@ -14,6 +14,10 @@
#include <stdint.h>
+#include "android/utils/compiler.h"
+
+ANDROID_BEGIN_HEADER
+
/* the emulator supports a simple .ini file format for its configuration
* files. See docs/ANDROID-CONFIG-FILES.TXT for details.
*/
@@ -107,6 +111,6 @@
void iniFile_setBoolean( IniFile* f, const char* key, int value );
void iniFile_setDiskSize( IniFile* f, const char* key, int64_t size );
-/* */
+ANDROID_END_HEADER
#endif /* _ANDROID_UTILS_INI_H */
diff --git a/android/utils/intmap.h b/android/utils/intmap.h
index 6fd450a..8a0d32a 100644
--- a/android/utils/intmap.h
+++ b/android/utils/intmap.h
@@ -12,6 +12,10 @@
#ifndef _ANDROID_UTILS_INTMAP_H
#define _ANDROID_UTILS_INTMAP_H
+#include "android/utils/compiler.h"
+
+ANDROID_BEGIN_HEADER
+
/* A simple container that can hold a simple mapping from integers to
* references. I.e. a dictionary where keys are integers, and values
* are liberal pointer values (NULL is allowed).
@@ -103,4 +107,6 @@
aintMapIterator_done(__aintmap_foreach_iter); \
} while (0)
+ANDROID_END_HEADER
+
#endif /* _ANDROID_UTILS_INTMAP_H */
diff --git a/android/utils/jpeg-compress.h b/android/utils/jpeg-compress.h
index 1f84a5d..a13ef99 100644
--- a/android/utils/jpeg-compress.h
+++ b/android/utils/jpeg-compress.h
@@ -12,6 +12,10 @@
#ifndef _ANDROID_UTILS_JPEG_COMPRESS_H
#define _ANDROID_UTILS_JPEG_COMPRESS_H
+#include "android/utils/compiler.h"
+
+ANDROID_BEGIN_HEADER
+
/*
* Contains declaration of utility routines that compress an RGB bitmap into
* a JPEG image.
@@ -96,4 +100,6 @@
int jpeg_quality,
int ydir);
+ANDROID_END_HEADER
+
#endif /* _ANDROID_UTILS_JPEG_COMPRESS_H */
diff --git a/android/utils/lineinput.h b/android/utils/lineinput.h
index 1870285..2fc6bd3 100644
--- a/android/utils/lineinput.h
+++ b/android/utils/lineinput.h
@@ -14,6 +14,10 @@
#include <stdio.h>
+#include "android/utils/compiler.h"
+
+ANDROID_BEGIN_HEADER
+
/* A LineInput is used to read input text, one line at a time,
* into a temporary buffer owner by the LineInput object.
*/
@@ -53,4 +57,6 @@
/* Free a LineInput object. */
void lineInput_free( LineInput* input );
+ANDROID_END_HEADER
+
#endif /* _ANDROID_UTILS_LINEINPUT_H */
diff --git a/android/utils/list.h b/android/utils/list.h
index a4171ae..d163ae9 100644
--- a/android/utils/list.h
+++ b/android/utils/list.h
@@ -14,6 +14,10 @@
#include <inttypes.h>
+#include "android/utils/compiler.h"
+
+ANDROID_BEGIN_HEADER
+
/* Encapsulates a double-linked, circular list.
* The list is organized in the following way:
* - List entries contain references to the next, and the previous entry in the
@@ -109,4 +113,6 @@
return entry;
}
+ANDROID_END_HEADER
+
#endif /* _ANDROID_UTILS_LIST_H */
diff --git a/android/utils/misc.h b/android/utils/misc.h
index 0d943f7..690249e 100644
--- a/android/utils/misc.h
+++ b/android/utils/misc.h
@@ -14,6 +14,10 @@
#include <stdint.h>
+#include "android/utils/compiler.h"
+
+ANDROID_BEGIN_HEADER
+
/** TABULAR OUTPUT
**
** prints a list of strings in row/column format
@@ -121,4 +125,6 @@
*/
extern int get_token_value_int(const char* params, const char* name, int* value);
+ANDROID_END_HEADER
+
#endif /* _ANDROID_UTILS_MISC_H */
diff --git a/android/utils/reflist.h b/android/utils/reflist.h
index 7275f54..8c3783f 100644
--- a/android/utils/reflist.h
+++ b/android/utils/reflist.h
@@ -13,8 +13,12 @@
#define _ANDROID_GRAPHICS_REFLIST_H
#include <inttypes.h>
+
+#include "android/utils/compiler.h"
#include <android/utils/system.h>
+ANDROID_BEGIN_HEADER
+
/* Definitions for a smart list of references to generic objects.
* supports safe deletion and addition while they are being iterated
* with AREFLIST_FOREACH() macro.
@@ -205,4 +209,6 @@
void areflist_copy(ARefList* dst, const ARefList* src);
+ANDROID_END_HEADER
+
#endif /* _ANDROID_GRAPHICS_REFLIST_H */
diff --git a/android/utils/refset.h b/android/utils/refset.h
index 4db9b2b..30cf61f 100644
--- a/android/utils/refset.h
+++ b/android/utils/refset.h
@@ -12,8 +12,11 @@
#ifndef _ANDROID_UTILS_REFSET_H
#define _ANDROID_UTILS_REFSET_H
+#include "android/utils/compiler.h"
#include <android/utils/vector.h>
+ANDROID_BEGIN_HEADER
+
/* this implements a set of addresses in memory.
* NULL cannot be stored in the set.
*/
@@ -73,4 +76,6 @@
_arefSet_removeDeferred(_set); \
} while (0)
+ANDROID_END_HEADER
+
#endif /* _ANDROID_UTILS_REFSET_H */
diff --git a/android/utils/stralloc.h b/android/utils/stralloc.h
index 626a638..76558b6 100644
--- a/android/utils/stralloc.h
+++ b/android/utils/stralloc.h
@@ -16,6 +16,10 @@
#include <stddef.h>
#include <stdarg.h>
+#include "android/utils/compiler.h"
+
+ANDROID_BEGIN_HEADER
+
/** DYNAMIC STRINGS
**/
@@ -62,4 +66,6 @@
extern char* stralloc_to_tempstr( stralloc_t* s );
+ANDROID_BEGIN_HEADER
+
#endif /* ANDROID_UTILS_STRALLOC_H */
diff --git a/android/utils/tempfile.h b/android/utils/tempfile.h
index 4264a84..150a15f 100644
--- a/android/utils/tempfile.h
+++ b/android/utils/tempfile.h
@@ -13,6 +13,10 @@
#ifndef _ANDROID_UTILS_TEMPFILE_H
#define _ANDROID_UTILS_TEMPFILE_H
+#include "android/utils/compiler.h"
+
+ANDROID_BEGIN_HEADER
+
/** TEMP FILE SUPPORT
**
** simple interface to create an empty temporary file on the system.
@@ -49,4 +53,6 @@
extern void atexit_close_fd(int fd);
extern void atexit_close_fd_remove(int fd);
+ANDROID_END_HEADER
+
#endif /* _ANDROID_UTILS_TEMPFILE_H */
diff --git a/android/utils/timezone.h b/android/utils/timezone.h
index bf5f731..a1e95a2 100644
--- a/android/utils/timezone.h
+++ b/android/utils/timezone.h
@@ -12,6 +12,10 @@
#ifndef _ANDROID_UTILS_TIMEZONE_H
#define _ANDROID_UTILS_TIMEZONE_H
+#include "android/utils/compiler.h"
+
+ANDROID_BEGIN_HEADER
+
/* try to set the default host timezone, returns 0 on success, or -1 if
* 'tzname' is not in zoneinfo format (e.g. Area/Location)
*/
@@ -28,4 +32,6 @@
*/
extern char* bufprint_zoneinfo_timezone( char* buffer, char* end );
+ANDROID_END_HEADER
+
#endif /* _ANDROID_UTILS_TIMEZONE_H */
diff --git a/android/utils/vector.h b/android/utils/vector.h
index c576ec7..f77628e 100644
--- a/android/utils/vector.h
+++ b/android/utils/vector.h
@@ -12,8 +12,11 @@
#ifndef _ANDROID_UTILS_VECTOR_H
#define _ANDROID_UTILS_VECTOR_H
-#include "android/utils/system.h"
#include "android/utils/assert.h"
+#include "android/utils/compiler.h"
+#include "android/utils/system.h"
+
+ANDROID_BEGIN_HEADER
#define AVECTOR_DECL(ctype,name) \
ctype* name; \
@@ -80,6 +83,6 @@
} \
} while (0);
-/* */
+ANDROID_END_HEADER
#endif /* _ANDROID_UTILS_VECTOR_H */
diff --git a/android/utils/win32_cmdline_quote.h b/android/utils/win32_cmdline_quote.h
index 86d2384..0ae8bd3 100644
--- a/android/utils/win32_cmdline_quote.h
+++ b/android/utils/win32_cmdline_quote.h
@@ -12,9 +12,9 @@
#ifndef ANDROID_UTILS_WIN32_CMDLINE_QUOTE_H
#define ANDROID_UTILS_WIN32_CMDLINE_QUOTE_H
-#ifdef __cplusplus
-extern "C" {
-#endif
+#include "android/utils/compiler.h"
+
+ANDROID_BEGIN_HEADER
// Quote a given command-line command or parameter so that it can be
// sent to _execv() on Windows, and be received properly by the new
@@ -36,8 +36,6 @@
// must free the string with android_free() or AFREE().
char* win32_cmdline_quote(const char* param);
-#ifdef __cplusplus
-}
-#endif
+ANDROID_END_HEADER
#endif // ANDROID_UTILS_WIN32_CMDLINE_QUOTE_H