liblog: Add const pedantics
(cherry picked from commit 9e03ce45f999b75000f1652747783d74e7063b9a)
Change-Id: I819695b778ac08fcfc9b1a87f3f86e5715f53084
diff --git a/include/log/logger.h b/include/log/logger.h
index 004b690..966397a 100644
--- a/include/log/logger.h
+++ b/include/log/logger.h
@@ -7,8 +7,8 @@
** General Public License.
*/
-#ifndef _UTILS_LOGGER_H
-#define _UTILS_LOGGER_H
+#ifndef _LIBS_LOG_LOGGER_H
+#define _LIBS_LOG_LOGGER_H
#include <stdint.h>
#include <log/log.h>
@@ -77,36 +77,36 @@
} extra;
} __attribute__((aligned(4)));
#ifdef __cplusplus
- /* Matching log_time_t operators */
- bool operator== (log_msg &T)
+ /* Matching log_time operators */
+ bool operator== (const log_msg &T) const
{
return (entry.sec == T.entry.sec) && (entry.nsec == T.entry.nsec);
}
- bool operator!= (log_msg &T)
+ bool operator!= (const log_msg &T) const
{
return !(*this == T);
}
- bool operator< (log_msg &T)
+ bool operator< (const log_msg &T) const
{
return (entry.sec < T.entry.sec)
|| ((entry.sec == T.entry.sec)
&& (entry.nsec < T.entry.nsec));
}
- bool operator>= (log_msg &T)
+ bool operator>= (const log_msg &T) const
{
return !(*this < T);
}
- bool operator> (log_msg &T)
+ bool operator> (const log_msg &T) const
{
return (entry.sec > T.entry.sec)
|| ((entry.sec == T.entry.sec)
&& (entry.nsec > T.entry.nsec));
}
- bool operator<= (log_msg &T)
+ bool operator<= (const log_msg &T) const
{
return !(*this > T);
}
- uint64_t nsec(void)
+ uint64_t nsec(void) const
{
return static_cast<uint64_t>(entry.sec) * NS_PER_SEC + entry.nsec;
}
@@ -167,4 +167,4 @@
}
#endif
-#endif /* _UTILS_LOGGER_H */
+#endif /* _LIBS_LOG_LOGGER_H */