Commit ed3da9614bb6bbac2ccb5652fc2e05980a481e43

Authored by Perry Werneck
1 parent 9dc08768
Exists in master and in 2 other branches develop, macos

Adding userdata on log writer.

src/core/ft/ft.c
... ... @@ -635,7 +635,8 @@ LIB3270_EXPORT LIB3270_FT_STATE lib3270_get_ft_state(H3270 *session) {
635 635 return ((H3270FT *) session->ft)->state;
636 636 }
637 637  
638   -LIB3270_EXPORT int lib3270_send(H3270 *hSession, const char *from, const char *to, const char **args) {
  638 +LIB3270_EXPORT int lib3270_send(H3270 *hSession, const char GNUC_UNUSED(*from), const char GNUC_UNUSED(*to), const char GNUC_UNUSED(**args)) {
  639 +
639 640 FAIL_IF_NOT_ONLINE(hSession);
640 641  
641 642 if(hSession->ft)
... ... @@ -644,7 +645,7 @@ LIB3270_EXPORT int lib3270_send(H3270 *hSession, const char *from, const char *t
644 645 return ENOTSUP;
645 646 }
646 647  
647   -LIB3270_EXPORT int lib3270_receive(H3270 *hSession, const char *from, const char *to, const char **args) {
  648 +LIB3270_EXPORT int lib3270_receive(H3270 *hSession, const char GNUC_UNUSED(*from), const char GNUC_UNUSED(*to), const char GNUC_UNUSED(**args)) {
648 649 FAIL_IF_NOT_ONLINE(hSession);
649 650  
650 651 if(hSession->ft)
... ...
src/core/linux/log.c
... ... @@ -42,7 +42,7 @@
42 42  
43 43 int use_syslog = 0;
44 44  
45   -int default_log_writer(H3270 GNUC_UNUSED(*session), void GNUC_UNUSED(*userdata), const char *module, int GNUC_UNUSED(rc), const char *message) {
  45 +int default_log_writer(const H3270 GNUC_UNUSED(*session), void GNUC_UNUSED(*userdata), const char *module, int GNUC_UNUSED(rc), const char *message) {
46 46 #ifdef HAVE_SYSLOG
47 47 if(use_syslog) {
48 48 syslog(LOG_INFO, "%s: %s", module, message);
... ...
src/core/log.c
... ... @@ -120,9 +120,10 @@ LIB3270_EXPORT int lib3270_set_log_filename(H3270 * hSession, const char *filena
120 120  
121 121 }
122 122  
123   -LIB3270_EXPORT void lib3270_set_log_handler(H3270 *session, const LIB3270_LOG_HANDLER handler) {
  123 +LIB3270_EXPORT void lib3270_set_log_handler(H3270 *session, const LIB3270_LOG_HANDLER handler, void *userdata) {
124 124 if(session) {
125 125 session->log.handler = (handler ? handler : default_log_writer);
  126 + session->log.userdata = userdata;
126 127 } else {
127 128 loghandler = (handler ? handler : default_log_writer);
128 129 }
... ...
src/core/windows/log.c
... ... @@ -41,9 +41,10 @@
41 41  
42 42 /*---[ Implement ]------------------------------------------------------------------------------------------*/
43 43  
44   -int default_log_writer(H3270 GNUC_UNUSED(*session), const char *module, int rc, const char *msg) {
  44 +int default_log_writer(const H3270 GNUC_UNUSED(*session), void GNUC_UNUSED(*userdata), const char *module, int rc, const char *msg) {
45 45  
46 46 if(hEventLog) {
  47 +
47 48 lib3270_autoptr(char) username = lib3270_get_user_name();
48 49  
49 50 const char *outMsg[] = {
... ...
src/include/internals.h
... ... @@ -740,7 +740,7 @@ LIB3270_INTERNAL void clear_chr(H3270 *hSession, int baddr);
740 740 LIB3270_INTERNAL unsigned char get_field_attribute(H3270 *session, int baddr);
741 741  
742 742 /// @brief Default log writer.
743   -LIB3270_INTERNAL int default_log_writer(H3270 *session, void *dunno, const char *module, int rc, const char *message);
  743 +LIB3270_INTERNAL int default_log_writer(const H3270 *session, void *dunno, const char *module, int rc, const char *message);
744 744  
745 745 /// @brief The active log handler.
746 746 LIB3270_INTERNAL LIB3270_LOG_HANDLER loghandler;
... ...
src/include/lib3270/log.h
... ... @@ -54,7 +54,7 @@ extern "C" {
54 54  
55 55 typedef int (*LIB3270_LOG_HANDLER)(const H3270 *, void *, const char *, int, const char *);
56 56  
57   -LIB3270_EXPORT void lib3270_set_log_handler(H3270 *session, const LIB3270_LOG_HANDLER loghandler);
  57 +LIB3270_EXPORT void lib3270_set_log_handler(H3270 *session, const LIB3270_LOG_HANDLER loghandler, void *userdata);
58 58 LIB3270_EXPORT int lib3270_set_log_filename(H3270 * hSession, const char *name);
59 59 LIB3270_EXPORT const char * lib3270_get_log_filename(const H3270 * hSession);
60 60  
... ...