struct tm;
+/* use this macro to statically allocate buffer for lutil_gentime */
+#define LDAP_LUTIL_GENTIME_BUFSIZE 22
LDAP_LUTIL_F( size_t )
lutil_gentime LDAP_P(( char *s, size_t max, const struct tm *tm ));
lutil_pair( ber_socket_t sd[2] );
/* uuid.c */
+/* use this macro to allocate buffer for lutil_uuidstr */
+#define LDAP_LUTIL_UUIDSTR_BUFSIZE 40
LDAP_LUTIL_F( size_t )
lutil_uuidstr( char *buf, size_t len );
/* csn.c */
+/* use this macro to allocate buffer for lutil_csnstr */
+#define LDAP_LUTIL_CSNSTR_BUFSIZE 64
LDAP_LUTIL_F( size_t )
lutil_csnstr( char *buf, size_t len, unsigned int replica, unsigned int mod );
int
main(int argc, char **argv)
{
- char buf[256];
+ char buf[ LDAP_LUTIL_CSNSTR_BUFSIZE ];
if ( ! lutil_csnstr( buf, (size_t) 10, 0, 0 ) ) {
fprintf(stderr, "failed lutil_csnstr\n");
db_env_set_func_yield( ldap_pvt_thread_yield );
{
- static char uuidbuf[40];
+ static char uuidbuf[ LDAP_LUTIL_UUIDSTR_BUFSIZE ];
bdb_uuid.bv_len = lutil_uuidstr( uuidbuf, sizeof( uuidbuf ));
bdb_uuid.bv_val = uuidbuf;
{
struct monitorentrypriv *mp;
struct tm *ltm;
- char buf[1024];
- char buf2[22];
- char buf3[22];
+ char buf[ 1024 ];
+ char buf2[ LDAP_LUTIL_GENTIME_BUFSIZE ];
+ char buf3[ LDAP_LUTIL_GENTIME_BUFSIZE ];
struct berval bv[2];
ldap_pvt_thread_mutex_lock( &gmtime_mutex );
ltm = gmtime( &c->c_starttime );
- lutil_gentime( buf2, sizeof(buf2), ltm );
+ lutil_gentime( buf2, sizeof( buf2 ), ltm );
ltm = gmtime( &c->c_activitytime );
- lutil_gentime( buf3, sizeof(buf2), ltm );
+ lutil_gentime( buf3, sizeof( buf3 ), ltm );
ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
struct monitorentrypriv *mp;
char buf[1024];
struct tm *tms;
- char tmbuf[20];
+ char tmbuf[ LDAP_LUTIL_GENTIME_BUFSIZE ];
/*
* Note: ltmbuf, ltm are used only if HACK_LOCAL_TIME is defined
Entry *e
)
{
- char stmbuf[20], ctmbuf[20];
+ char stmbuf[ LDAP_LUTIL_GENTIME_BUFSIZE ],
+ ctmbuf[ LDAP_LUTIL_GENTIME_BUFSIZE ];
struct tm *stm, *ctm;
Attribute *a;
ber_len_t len;
char *textbuf, size_t textlen )
{
struct berval name, timestamp, csn;
- char timebuf[22];
- char csnbuf[64];
+ char timebuf[ LDAP_LUTIL_GENTIME_BUFSIZE ];
+ char csnbuf[ LDAP_LUTIL_CSNSTR_BUFSIZE ];
Modifications *mod;
int mop = op->o_tag == LDAP_REQ_ADD
}
if( SLAP_LASTMOD(be) ) {
- char uuidbuf[40];
+ char uuidbuf[ LDAP_LUTIL_UUIDSTR_BUFSIZE ];
tmpval.bv_len = lutil_uuidstr( uuidbuf, sizeof( uuidbuf ) );
tmpval.bv_val = uuidbuf;
if ( SLAP_LASTMOD(be) ) {
struct tm *ltm;
time_t now = slap_get_time();
- char uuidbuf[40];
- struct berval vals[2];
+ char uuidbuf[ LDAP_LUTIL_UUIDSTR_BUFSIZE ];
+ struct berval vals[ 2 ];
struct berval name, timestamp, csn;
- char timebuf[22];
- char csnbuf[64];
+ char timebuf[ LDAP_LUTIL_GENTIME_BUFSIZE ];
+ char csnbuf[ LDAP_LUTIL_CSNSTR_BUFSIZE ];
ltm = gmtime(&now);
lutil_gentime( timebuf, sizeof(timebuf), ltm );