mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-23 08:09:34 -05:00
Format fixes: Debug() arg#2 must be format.
Warning cleanup: Move format strings, let gcc recognize them. Unused var.
This commit is contained in:
parent
2c3a06321a
commit
453d3c0710
1 changed files with 12 additions and 13 deletions
|
|
@ -62,14 +62,14 @@ constraint_violation( constraint *c, struct berval *bv )
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
print_message( const char *fmt, AttributeDescription *a )
|
print_message( const char *msg, AttributeDescription *a )
|
||||||
{
|
{
|
||||||
char *ret;
|
char *ret;
|
||||||
int sz;
|
int sz;
|
||||||
|
|
||||||
sz = strlen(fmt) + a->ad_cname.bv_len + 1;
|
sz = strlen(msg) + a->ad_cname.bv_len + sizeof(" on ");
|
||||||
ret = ch_malloc(sz);
|
ret = ch_malloc(sz);
|
||||||
snprintf( ret, sz, fmt, a->ad_cname.bv_val );
|
snprintf( ret, sz, "%s on %s", msg, a->ad_cname.bv_val );
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -81,7 +81,7 @@ constraint_add( Operation *op, SlapReply *rs )
|
||||||
constraint *c = on->on_bi.bi_private, *cp;
|
constraint *c = on->on_bi.bi_private, *cp;
|
||||||
BerVarray b = NULL;
|
BerVarray b = NULL;
|
||||||
int i;
|
int i;
|
||||||
const char *rsv = "add breaks regular expression constraint on %s";
|
const char *rsv = "add breaks regular expression constraint";
|
||||||
char *msg;
|
char *msg;
|
||||||
|
|
||||||
if ((a = op->ora_e->e_attrs) == NULL) {
|
if ((a = op->ora_e->e_attrs) == NULL) {
|
||||||
|
|
@ -126,7 +126,7 @@ constraint_modify( Operation *op, SlapReply *rs )
|
||||||
Modifications *m;
|
Modifications *m;
|
||||||
BerVarray b = NULL;
|
BerVarray b = NULL;
|
||||||
int i;
|
int i;
|
||||||
const char *rsv = "modify breaks regular expression constraint on %s";
|
const char *rsv = "modify breaks regular expression constraint";
|
||||||
char *msg;
|
char *msg;
|
||||||
|
|
||||||
if ((m = op->orm_modlist) == NULL) {
|
if ((m = op->orm_modlist) == NULL) {
|
||||||
|
|
@ -176,7 +176,6 @@ static int constraint_config(
|
||||||
{
|
{
|
||||||
slap_overinst *on = (slap_overinst *) be->bd_info;
|
slap_overinst *on = (slap_overinst *) be->bd_info;
|
||||||
constraint ap = { NULL, NULL, NULL }, *a2 = NULL;
|
constraint ap = { NULL, NULL, NULL }, *a2 = NULL;
|
||||||
regmatch_t rm[2];
|
|
||||||
|
|
||||||
if ( strcasecmp( argv[0], "constraint_attribute" ) == 0 ) {
|
if ( strcasecmp( argv[0], "constraint_attribute" ) == 0 ) {
|
||||||
const char *text;
|
const char *text;
|
||||||
|
|
@ -200,19 +199,19 @@ static int constraint_config(
|
||||||
|
|
||||||
ap.re = ch_malloc( sizeof(regex_t) );
|
ap.re = ch_malloc( sizeof(regex_t) );
|
||||||
if ((err = regcomp( ap.re, argv[3], REG_EXTENDED )) != 0) {
|
if ((err = regcomp( ap.re, argv[3], REG_EXTENDED )) != 0) {
|
||||||
const char *fmt = "%s: line %d: Illegal regular expression \"%s\": Error %s\n";
|
static const char fmt[] = "\"%s\": Error %s";
|
||||||
char errmsg[1024], *msg;
|
char errmsg[1024], *msg;
|
||||||
int i, l, msgsize;
|
int msgsize;
|
||||||
|
|
||||||
msgsize = regerror( err, ap.re, errmsg, sizeof(errmsg) );
|
msgsize = regerror( err, ap.re, errmsg, sizeof(errmsg) );
|
||||||
msgsize += strlen(fmt) + strlen(argv[3]) + strlen(fname);
|
msgsize += STRLENOF(fmt) - STRLENOF("%s%s") + strlen(argv[3]);
|
||||||
for(l=lineno; l>0; l/=10, msgsize++);
|
|
||||||
msgsize++;
|
|
||||||
|
|
||||||
msg = ch_malloc( msgsize + 1 );
|
msg = ch_malloc( msgsize + 1 );
|
||||||
snprintf( msg, msgsize, fmt, fname, lineno, argv[3], errmsg );
|
snprintf( msg, msgsize, fmt, argv[3], errmsg );
|
||||||
ch_free(ap.re);
|
ch_free(ap.re);
|
||||||
Debug( LDAP_DEBUG_ANY, msg, 0, 0, 0);
|
Debug( LDAP_DEBUG_ANY,
|
||||||
|
"%s: line %d: Illegal regular expression %s\n",
|
||||||
|
fname, lineno, msg );
|
||||||
ch_free(msg);
|
ch_free(msg);
|
||||||
ap.re = NULL;
|
ap.re = NULL;
|
||||||
return(1);
|
return(1);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue