Skip to content

Commit

Permalink
QRcode_clearCache() has been added.
Browse files Browse the repository at this point in the history
  • Loading branch information
fukuchi committed Jun 8, 2009
1 parent 3e7a9b4 commit 9b28498
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 10 deletions.
2 changes: 2 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
* qrencode.c:
- FrameFiller_nextMQR() has integrated to FrameFiller_next().
- FrameFiller_new() now requires mqr flag.
* qrencode.[ch], tests/prof_qrencode.c, tests/test_{qrencode,monkey}.c:
- QRcode_clearCache() has been added.

2009.06.06 Kentaro FUKUCHI <fukuchi@megaui.net>
* qrenc.c, tests/view_qrcode.c:
Expand Down
11 changes: 11 additions & 0 deletions qrencode.c
Original file line number Diff line number Diff line change
Expand Up @@ -848,3 +848,14 @@ QRcode_List *QRcode_encodeStringStructured(const char *string, int version, QRec

return codes;
}

/******************************************************************************
* System utilities
*****************************************************************************/

void QRcode_clearCache(void)
{
QRspec_clearCache();
MQRspec_clearCache();
free_rs_cache();
}
11 changes: 11 additions & 0 deletions qrencode.h
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,17 @@ extern int QRcode_List_size(QRcode_List *qrlist);
*/
extern void QRcode_List_free(QRcode_List *qrlist);


/******************************************************************************
* System utilities
*****************************************************************************/

/**
* Clear all caches. This is only for debug purpose. If you are attacking a
* complicated memory leak bug, try this to reduce the reachable blocks record.
*/
extern void QRcode_clearCache(void);

#if defined(__cplusplus)
}
#endif
Expand Down
5 changes: 1 addition & 4 deletions tests/prof_qrencode.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
#include <time.h>
#include <errno.h>
#include "../qrencode.h"
#include "../qrspec.h"
#include "../rscode.h"

struct timeval tv;
void timerStart(const char *str)
Expand Down Expand Up @@ -70,8 +68,7 @@ int main(void)
prof_ver1to10();
prof_ver31to40();

QRspec_clearCache();
free_rs_cache();
QRcode_clearCache();

return 0;
}
4 changes: 1 addition & 3 deletions tests/test_monkey.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "../qrinput.h"
#include "../split.h"
#include "../qrspec.h"
#include "../rscode.h"

#define MAX_LENGTH 7091
static char data[MAX_LENGTH];
Expand Down Expand Up @@ -317,8 +316,7 @@ int main(int argc, char **argv)
monkey_split_kanji(loop);
monkey_split_structure(loop);

QRspec_clearCache();
free_rs_cache();
QRcode_clearCache();

report();

Expand Down
4 changes: 1 addition & 3 deletions tests/test_qrencode.c
Original file line number Diff line number Diff line change
Expand Up @@ -676,9 +676,7 @@ int main(void)
test_encodeTooLongMQR();
test_mqrraw_new();

QRspec_clearCache();
MQRspec_clearCache();
free_rs_cache();
QRcode_clearCache();

report();

Expand Down

0 comments on commit 9b28498

Please sign in to comment.