summaryrefslogtreecommitdiff
path: root/src/common/db.c
AgeCommit message (Collapse)AuthorFilesLines
2013-05-02Introducing Hercules Plugin Manangershennetsind1-6/+14
http://hercules.ws/board/topic/549-introducing-hercules-plugin-manager/ Signed-off-by: shennetsind <ind@henn.et>
2012-12-05- Undid r16968: SVN Replaced with source:/trunk/src/@16966 (tid:74924).brianluau1-1634/+1612
[16969:16991/trunk/src/] will be re-committed in the next 24 hours. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16992 54d463be-8e91-2dee-dedb-b68131a5f0ec
2012-11-25Applied AStyle code formating as discussed on tid:74602.greenboxal21-1612/+1634
Removed /SAFESEH option from MSVC11 projects. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16968 54d463be-8e91-2dee-dedb-b68131a5f0ec
2012-10-29-Add some src basic documentation.glighta1-3/+3
-Change some remaining -1 for status ending timer. -Move some hardcoded msg in msg_athena -Small optimisation on battle_attr_fix git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16835 54d463be-8e91-2dee-dedb-b68131a5f0ec
2012-09-02Hello! few things.shennetsind1-1/+1
1) fixed bugreport:6603 - delayed clearunit now makes use of the ERS which is quite convenient for it speeds up due to the previous amount of mallocs that function would spend. 2) added extra debug information to the ERS system (before on any of its warnings we'd go OH MY GOD WHICH ONE OF THEM DID IT!!!), now upon allocation you give it a const, human-readable, name. 3) added support for options in the ERS system to save multiple/redudant processing in battle_delayed_damage and clif_clearunit_delayed and perhaps also in the future. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16736 54d463be-8e91-2dee-dedb-b68131a5f0ec
2012-08-22Major cleanup all over the place, made possible by mkbu95's scan-build ↵shennetsind1-6/+7
report he provided us with. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16687 54d463be-8e91-2dee-dedb-b68131a5f0ec
2012-03-13Enhanced `DBMap` implementation to allow storing integer type data in ↵gepard19841-88/+208
addition to void pointers. - Added enum for data: `int`, `unsigned int` and `void*` - Replaced generic `void*` data with `DBData` struct to hold `int`, `unsigned int` or `void*` (member of `DBNode`) - Added `db_i2data`, `db_ui2data` and `db_ptr2data` functions to cast from `int`/`uint`/`void*` to `DBData` (used in `DBMap::put()`) - Added `db_data2i`, `db_data2ui` and `db_data2ptr` functions to get `int`/`uint`/`void*` from `DBData` - Enabled statistics for new functions in `db_stats` struct - `DBCreateData` functions (used in `DBMap::ensure()`) now return `DBData` instead of `void*` - `DBApply` functions (used in `DBMap::foreach()` and `DBMap::destroy()`) now take `DBData*` as a parameter instead of `void*` - `DBMatcher` functions (used in `DBMap::getall()`) now take `DBData` as a parameter instead of `void*` - `DBReleaser` functions now take `DBData` as parameter instead of `void*` - Default releasers release data if it is `void*` (`DB_DATA_PTR`) type - `DBIterator` functions: `first()`, `last()`, `next()` and `prev()` now return `DBData*` instead of `void*` - `DBIterator::remove()` now returns `int` (1 if node was found and removed, 0 otherwise) instead of `void*` and takes an extra `DBData*` parameter for the data of removed entry - `DBMap::get()` and `DBMap::ensure()` now return `DBData*` instead of `void*` - `DBMap::remove()` and `DBMap::put()` now return `int` (1 if node already existed, 0 otherwise) instead of `void*` and take an extra `DBData*` parameter for the data of removed entry - `DBMap::put()` now takes `DBData` as parameter instead of `void*` - `DBMap::getall()` now puts data into `DBData**` buffer instead of `void**` buffer - Updated macros: - (`i`/`ui`/`str`)`db_get` and (`i`/`ui`/`str`)`db_ensure` were wrapped with `db_data2ptr` to extract data from `DBData*` that is now returned by `DBMap::get()` - added (`i`/`ui`/`str`)`db_iget` and (`i`/`ui`/`str`)`db_uiget` that get `DBData` from `DBMap` and extract `int`/`unsigned int` from it (with `db_data2i`/`db_data2ui`) - `db_put`, `idb_put`, `uidb_put` and `strdb_put` data params were wrapped with `db_ptr2data` to match new signature of `DBMap::put()` (`DBData` instead of `void*`) - added (`i`/`ui`/`str`)`db_iput` and (`i`/`ui`/`str`)`db_uiput` that put `int`/`unsigned int` into `DBMap` (first wrapping it with `DBData`) - added `NULL` in place of extra parameter for removed data in `db_remove` macros - `dbi_first`, `dbi_last`, `dbi_next` and `dbi_prev` were wrapped with `db_data2ptr` to extract data from `DBData*` that is now returned by these `DBIterator` functions - Updated `DBMap` documentation, and fixed a dozen of typos in it. - Updated rest of rA code to reflect `DBMap` changes (mostly required signature changes of `DBCreateData` and `DBApply` functions). - Fixed a bug where `DBMap::put()` would return data of a deleted entry. - Removed some unnecessary pointer casts. - Increased `showmsg.c` static buffer size to fit entire DBMap stats report. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15682 54d463be-8e91-2dee-dedb-b68131a5f0ec
2012-02-24Fixed `va_list` being reused in DBMap code (`linkdb_foreach()`) ↵gepard19841-4/+3
(bugreport:5367). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15628 54d463be-8e91-2dee-dedb-b68131a5f0ec
2011-12-11* Merged changes up to eAthena 15032.eathenabot1-8/+0
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15065 54d463be-8e91-2dee-dedb-b68131a5f0ec
2011-07-04* Fixed 'strnlen' still causing warnings in db.c on Debian (follow up to ↵ai4rei1-1/+0
r14855). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14885 54d463be-8e91-2dee-dedb-b68131a5f0ec
2011-06-18* Fixed missing strlib.h include for compilers without own 'strnlen' ↵ai4rei1-0/+1
implementation (since r14853). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14855 54d463be-8e91-2dee-dedb-b68131a5f0ec
2011-06-16Moved DBMap's string maxlen parameter translation (0 -> UINT16_MAX) to its ↵ultramage1-14/+5
initialization phase, so that it runs once instead of on every hash and compare step. This will slightly speed up most strdb operations. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14854 54d463be-8e91-2dee-dedb-b68131a5f0ec
2011-06-16Fixed DBMap's db_dup_key to allocate only as much as necessary (bugreport:4969).ultramage1-8/+8
This reduces default eA's memory usage by about 400kB. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14853 54d463be-8e91-2dee-dedb-b68131a5f0ec
2011-06-16* Merges from charmerge:flaviojs1-3/+57
- Added DBMap::exists. (r14090) - Added sv_parse_next, a stepped version of sv_parse (delim-separated parser). (r14100 r14104) - Added missing fd check to do_close. (r14145) - Normalized, refactored and restructured some code (in preparation for shutdown/reconnect code). (r14145 r14150) - Changed the char select request code to allow the char-server to reject it. (player in map-server trying to go to char select) (r14150) - Added shutdown support to the servers. (incomplete) (r14152) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14851 54d463be-8e91-2dee-dedb-b68131a5f0ec
2011-01-15* Various accumulated insignificant fixes to documentation, examples and ↵ai4rei1-1/+1
comments. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14674 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-12-29* Collection of random insignificant changes.ai4rei1-1/+1
- Added progress indication on map-server shutdown when objects are removed from maps, as it takes significant amount of time to complete. - Moved ers_free in db_obj_vclear, so that the node pointer is not used for comparison after it has been freed. - Some documentation of shop packets. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14639 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-11-19* Various VC6-related fixes and tweaks. [Ai4rei]ai4rei1-16/+16
- Fixed a typo in VC6 project files, that prevented login-server from compiling (bugreport:4061, since r12727). - Fixed usage of 'long long' in Sql_P_BindSqlDataType preventing SQL VC6 projects from compiling (bugreport:1741, since r10779). - Fixed usage of 'long long' in strtoull preventing VC6 projects from compiling (bugreport:4059, follow up to r14245). - Made strtoull default to base 10 and actually process base 8, to match the normal behavior of this function (bugreport:4059, follow up to r14245). - Fixed functions in db.c not being returned as pointer, causing warnings on VC6. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14466 54d463be-8e91-2dee-dedb-b68131a5f0ec
2009-06-20- Instancing System (Thanks to Sirius White who did most of the code, with ↵zephyrus1-0/+15
some of my work to implement client side information, some optimizations and bugfixes). Also thanks to contributions from UEAUP team and Orcao. - Fixed a bug on areamobuseskill and changed it to make it as Aegis. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13901 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-06-18Fixed a bug in the timer code which made it impossible to delete a timer ↵ultramage1-1/+1
with id '0' (since pre-svn, still present in jAthena). Fixed wrong order of parameters in a ShowWarning call when freeing a locked DBMap, which caused a segfault when executed (since initial implementation in r4859). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12854 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-05-02Added a custom implementation of the va_copy macro for systems that don't ↵ultramage1-7/+26
provide it. Fixed varargs not being used correctly in foreach() calls in db.c (bugreport:551). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12682 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-03-26Adjusted eAthena code to compile cleanly in C++ mode.ultramage1-10/+25
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12436 54d463be-8e91-2dee-dedb-b68131a5f0ec
2008-02-19* Fixed db_obj_get not handling deleted nodes correctly. (bugreport:999)FlavioJS1-8/+17
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12217 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-11-09* Added a database iterator to db.c/db.h.FlavioJS1-1/+341
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11701 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-11-08* Changed EXIT_SUCCESS back to 0 in console.c to avoid an unnecessary include.FlavioJS1-284/+173
* Fixed gm_account_db not being deallocated in login-converter.c. * Refactoring names and documentation in db.h/db.c: - changed 'struct dbt' to 'struct DBMap' and 'DB' to 'DBMap*' - changed 'struct db' to 'struct DBMap_impl' and 'DB_impl' to 'DBMap_impl*' - changed COUNT to DB_COUNTSTAT and made it's existence not depend on DB_ENABLE_STATS - removed some @see links and corrected small typos in the documentation git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11698 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-09-20* Merged the tmpsql branch:FlavioJS1-1/+0
- Abstraction for the sql code (sql.c/h). - New configure script and makefiles. - Restored txt zeny logging code. (r10814) - Rewrote mapserver's sql code - itemdb, mobdb, mapreg, logs. (r10814) - Fixed a precedence issue (&& and ) in char_sql/char.c. (r10833) - Improved db reading code a bit for consistency. (r11077) - Added separate atcommand for mail deletion. (r11077) - Corrected a few messages that said "new" instead of "unread". (r11077) - Broadcast (*) messages now use "*" as the target's name (not ""). (r11077) - Moved StringBuf code from utils.c/h to strlib.c/h. (r11084 r11117) - Some misc login server cleanups (reformatting etc). (r11136) - Corrected/modified some header entries. (r11141 r11147 11148) - Adjusted VS project files. (r11147) - Adjusted the way the sql charserver does item saving. (r11192) - Corrected usage of reserved keyword 'friend' in mmo.h. (r11192) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11245 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-04-29Gave each file an empty last line, to make svn happierultramage1-1/+0
Added svn:eol-style native where missing Removed remaining .gats git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10401 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-04-16* Finally fixed mingw problems, managed to build both TXT and SQLultramage1-3/+3
* Fixed the uint32 platform problem (Microsoft failed so I removed it :) * Removed the cbasetypes.h dependency from the mapcache generator * Removed some random compilation warnings git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10270 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-04-09* Changed db key from 'unsigned char*' to 'const char*'.FlavioJS1-43/+27
* Defined out the dump function in util.h/c. Notes: saw some suspicious code in npc.c so kept the 'const char*' propagation to a minimum for now git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10193 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-04-02* Some source code cleaningultramage1-0/+4
- Fixed the badly worded messages during mapserver startup - Cleaned up socket config reading - Split resolve_hostbyname() into 2 separate functions for clarity - Moved the probably obsolete LOWER/UPPER macros to db.c (TODO: remove) - Moved the badly placed compare_item() function to storage.c (see r779) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10119 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-12-21- Added a 1-node cache to db. Removed party_cache and guild_cache since now ↵FlavioJS1-79/+85
the database has a cache. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9545 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-12-18- Cosmetic changes to db.FlavioJS1-329/+267
- Fixed the unused MAPINDEX_AUTOADD section in mapindex.c (mapindex.h wasn't being included) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9515 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-12-12- Minor changes to ers.FlavioJS1-2/+2
- Removed unused/hardly used cbasetypes typedefs. - Updated txt-converter's makefile to include utils.o git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9473 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-12-05- Massive EOL normalization & 'svn:eol-style native' flag setting for all ↵FlavioJS1-2448/+2448
txt/conf/h/c files. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9410 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-22* WARNING: New scripting system contains memory leakLance1-0/+104
TODO: Free all scripts using script_free_code() instead of old methods. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6690 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-01-29AS OF SVN REV. 5901, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES ↵Valaris1-0/+2344
GO INTO TRUNK. IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. EVERYTHING ELSE GOES INTO TRUNK AND WILL BE MERGED INTO STABLE BY VALARIS AND WIZPUTER. -- VALARIS git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5094 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-01-29Clearing trunk.Valaris1-662/+0
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5091 54d463be-8e91-2dee-dedb-b68131a5f0ec
2005-03-23git-svn-id: ↵celest1-2/+65
https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1274 54d463be-8e91-2dee-dedb-b68131a5f0ec
2005-03-07Replaced some free's with aFreecelest1-4/+4
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1208 54d463be-8e91-2dee-dedb-b68131a5f0ec
2005-03-07* Updated core and map-server to jA 1115~1137celest1-16/+90
* Fixed a typo in Volcano git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1206 54d463be-8e91-2dee-dedb-b68131a5f0ec
2005-02-22* Corrected Spiral Pierce's hits in the skill_dbcelest1-2/+18
* Moved /common/*.o into a obj folder when compiling * Updated core and map server to jA 1094~1115 git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1162 54d463be-8e91-2dee-dedb-b68131a5f0ec
2005-01-24Some more changes for g++(no author)1-5/+7
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@972 54d463be-8e91-2dee-dedb-b68131a5f0ec
2005-01-23update(no author)1-3/+3
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@968 54d463be-8e91-2dee-dedb-b68131a5f0ec
2004-12-29cxx updatesamber1-0/+1
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@861 54d463be-8e91-2dee-dedb-b68131a5f0ec
2004-12-17FIXED!Lupus1-5/+6
Removed Freya's code: "added null pointer check from freya" it caused NPC bugs: OnTime, OnInit etc sorry 8) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@596 54d463be-8e91-2dee-dedb-b68131a5f0ec
2004-12-17git-svn-id: ↵mc_cameri1-1/+1
https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@595 54d463be-8e91-2dee-dedb-b68131a5f0ec
2004-12-16added null pointer check from freyaLupus1-1/+5
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@588 54d463be-8e91-2dee-dedb-b68131a5f0ec
2004-11-14Fixed some file typesamber1-501/+501
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/athena@172 54d463be-8e91-2dee-dedb-b68131a5f0ec
2004-11-04git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/athena@2 ↵(no author)1-0/+501
54d463be-8e91-2dee-dedb-b68131a5f0ec