summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authoreathenabot <eathenabot@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-12-11 21:06:25 +0000
committereathenabot <eathenabot@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-12-11 21:06:25 +0000
commit415e738feb188909dea60831aef07c4fb0fe0f17 (patch)
tree655d59ab571962a2b3fa2fdc492bee3b83b024cc /src/common
parentd187830a9f19239d7f43729a51198ed9dd8c176f (diff)
downloadhercules-415e738feb188909dea60831aef07c4fb0fe0f17.tar.gz
hercules-415e738feb188909dea60831aef07c4fb0fe0f17.tar.bz2
hercules-415e738feb188909dea60831aef07c4fb0fe0f17.tar.xz
hercules-415e738feb188909dea60831aef07c4fb0fe0f17.zip
* Merged changes up to eAthena 15032.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15065 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/common')
-rw-r--r--src/common/db.c8
-rw-r--r--src/common/db.h63
-rw-r--r--src/common/mmo.h1
3 files changed, 16 insertions, 56 deletions
diff --git a/src/common/db.c b/src/common/db.c
index c9b124455..74c3b1f91 100644
--- a/src/common/db.c
+++ b/src/common/db.c
@@ -2437,14 +2437,11 @@ DBMap* db_alloc(const char *file, int line, DBType type, DBOptions options, unsi
return &db->vtable;
}
-#ifdef DB_MANUAL_CAST_TO_UNION
/**
* Manual cast from 'int' to the union DBKey.
- * Created for compilers that don't support casting to unions.
* @param key Key to be casted
* @return The key as a DBKey union
* @public
- * @see #DB_MANUAL_CAST_TO_UNION
*/
DBKey db_i2key(int key)
{
@@ -2457,11 +2454,9 @@ DBKey db_i2key(int key)
/**
* Manual cast from 'unsigned int' to the union DBKey.
- * Created for compilers that don't support casting to unions.
* @param key Key to be casted
* @return The key as a DBKey union
* @public
- * @see #DB_MANUAL_CAST_TO_UNION
*/
DBKey db_ui2key(unsigned int key)
{
@@ -2474,11 +2469,9 @@ DBKey db_ui2key(unsigned int key)
/**
* Manual cast from 'const char *' to the union DBKey.
- * Created for compilers that don't support casting to unions.
* @param key Key to be casted
* @return The key as a DBKey union
* @public
- * @see #DB_MANUAL_CAST_TO_UNION
*/
DBKey db_str2key(const char *key)
{
@@ -2488,7 +2481,6 @@ DBKey db_str2key(const char *key)
ret.str = key;
return ret;
}
-#endif /* DB_MANUAL_CAST_TO_UNION */
/**
* Initializes the database system.
diff --git a/src/common/db.h b/src/common/db.h
index e5515803c..d4728cbbf 100644
--- a/src/common/db.h
+++ b/src/common/db.h
@@ -46,8 +46,6 @@
/*****************************************************************************\
* (1) Section with public typedefs, enums, unions, structures and defines. *
- * DB_MANUAL_CAST_TO_UNION - Define when the compiler doesn't allow casting *
- * to unions. *
* DBRelease - Enumeration of release options. *
* DBType - Enumeration of database types. *
* DBOptions - Bitfield enumeration of database options. *
@@ -62,19 +60,6 @@
\*****************************************************************************/
/**
- * Define this to enable the functions that cast to unions.
- * Required when the compiler doesn't support casting to unions.
- * NOTE: It is recommened that the conditional tests to determine if this
- * should be defined be located in the configure script or a header file
- * specific for compatibility and portability issues.
- * @public
- * @see #db_i2key(int)
- * @see #db_ui2key(unsigned int)
- * @see #db_str2key(unsigned char *)
- */
-//#define DB_MANUAL_CAST_TO_UNION
-
-/**
* Bitfield with what should be released by the releaser function (if the
* function supports it).
* @public
@@ -575,42 +560,32 @@ struct DBMap {
};
//For easy access to the common functions.
-#ifdef DB_MANUAL_CAST_TO_UNION
-# define i2key db_i2key
-# define ui2key db_ui2key
-# define str2key db_str2key
-#else /* not DB_MANUAL_CAST_TO_UNION */
-# define i2key(k) ((DBKey)(int)(k))
-# define ui2key(k) ((DBKey)(unsigned int)(k))
-# define str2key(k) ((DBKey)(const char *)(k))
-#endif /* not DB_MANUAL_CAST_TO_UNION */
-
#define db_exists(db,k) ( (db)->exists((db),(k)) )
-#define idb_exists(db,k) ( (db)->exists((db),i2key(k)) )
-#define uidb_exists(db,k) ( (db)->exists((db),ui2key(k)) )
-#define strdb_exists(db,k) ( (db)->exists((db),str2key(k)) )
+#define idb_exists(db,k) ( (db)->exists((db),db_i2key(k)) )
+#define uidb_exists(db,k) ( (db)->exists((db),db_ui2key(k)) )
+#define strdb_exists(db,k) ( (db)->exists((db),db_str2key(k)) )
#define db_get(db,k) ( (db)->get((db),(k)) )
-#define idb_get(db,k) ( (db)->get((db),i2key(k)) )
-#define uidb_get(db,k) ( (db)->get((db),ui2key(k)) )
-#define strdb_get(db,k) ( (db)->get((db),str2key(k)) )
+#define idb_get(db,k) ( (db)->get((db),db_i2key(k)) )
+#define uidb_get(db,k) ( (db)->get((db),db_ui2key(k)) )
+#define strdb_get(db,k) ( (db)->get((db),db_str2key(k)) )
#define db_put(db,k,d) ( (db)->put((db),(k),(d)) )
-#define idb_put(db,k,d) ( (db)->put((db),i2key(k),(d)) )
-#define uidb_put(db,k,d) ( (db)->put((db),ui2key(k),(d)) )
-#define strdb_put(db,k,d) ( (db)->put((db),str2key(k),(d)) )
+#define idb_put(db,k,d) ( (db)->put((db),db_i2key(k),(d)) )
+#define uidb_put(db,k,d) ( (db)->put((db),db_ui2key(k),(d)) )
+#define strdb_put(db,k,d) ( (db)->put((db),db_str2key(k),(d)) )
#define db_remove(db,k) ( (db)->remove((db),(k)) )
-#define idb_remove(db,k) ( (db)->remove((db),i2key(k)) )
-#define uidb_remove(db,k) ( (db)->remove((db),ui2key(k)) )
-#define strdb_remove(db,k) ( (db)->remove((db),str2key(k)) )
+#define idb_remove(db,k) ( (db)->remove((db),db_i2key(k)) )
+#define uidb_remove(db,k) ( (db)->remove((db),db_ui2key(k)) )
+#define strdb_remove(db,k) ( (db)->remove((db),db_str2key(k)) )
//These are discarding the possible vargs you could send to the function, so those
//that require vargs must not use these defines.
#define db_ensure(db,k,f) ( (db)->ensure((db),(k),(f)) )
-#define idb_ensure(db,k,f) ( (db)->ensure((db),i2key(k),(f)) )
-#define uidb_ensure(db,k,f) ( (db)->ensure((db),ui2key(k),(f)) )
-#define strdb_ensure(db,k,f) ( (db)->ensure((db),str2key(k),(f)) )
+#define idb_ensure(db,k,f) ( (db)->ensure((db),db_i2key(k),(f)) )
+#define uidb_ensure(db,k,f) ( (db)->ensure((db),db_ui2key(k),(f)) )
+#define strdb_ensure(db,k,f) ( (db)->ensure((db),db_str2key(k),(f)) )
// Database creation and destruction macros
#define idb_alloc(opt) db_alloc(__FILE__,__LINE__,DB_INT,(opt),sizeof(int))
@@ -729,37 +704,29 @@ DBReleaser db_custom_release(DBRelease which);
*/
DBMap* db_alloc(const char *file, int line, DBType type, DBOptions options, unsigned short maxlen);
-#ifdef DB_MANUAL_CAST_TO_UNION
/**
* Manual cast from 'int' to the union DBKey.
- * Created for compilers that don't support casting to unions.
* @param key Key to be casted
* @return The key as a DBKey union
* @public
- * @see #DB_MANUAL_CAST_TO_UNION
*/
DBKey db_i2key(int key);
/**
* Manual cast from 'unsigned int' to the union DBKey.
- * Created for compilers that don't support casting to unions.
* @param key Key to be casted
* @return The key as a DBKey union
* @public
- * @see #DB_MANUAL_CAST_TO_UNION
*/
DBKey db_ui2key(unsigned int key);
/**
* Manual cast from 'unsigned char *' to the union DBKey.
- * Created for compilers that don't support casting to unions.
* @param key Key to be casted
* @return The key as a DBKey union
* @public
- * @see #DB_MANUAL_CAST_TO_UNION
*/
DBKey db_str2key(const char *key);
-#endif /* DB_MANUAL_CAST_TO_UNION */
/**
* Initialize the database system.
diff --git a/src/common/mmo.h b/src/common/mmo.h
index f8ef63390..2b39bf6d8 100644
--- a/src/common/mmo.h
+++ b/src/common/mmo.h
@@ -47,6 +47,7 @@
#define PACKETVER 20110609
//#define PACKETVER 20100730
#endif
+
// backward compatible PACKETVER 8 and 9
#if PACKETVER == 8
#undef PACKETVER