]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/limits.c
Don't bother setting up threads if there are no indexed attrs
[openldap] / servers / slapd / limits.c
index 691a1163661659fb730db628a721666d26ea3c45..ef26010606c903621489aaa9215a57e115a68092 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2005 The OpenLDAP Foundation.
+ * Copyright 1998-2006 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -650,14 +650,9 @@ limits_parse_one(
                                        limit->lms_t_soft = -1;
 
                                } else {
-                                       char    *next = NULL;
-                                       int     soft = strtol( arg, &next, 10 );
+                                       int     soft;
 
-                                       if ( next == arg || next[ 0 ] != '\0' ) {
-                                               return( 1 );
-                                       }
-
-                                       if ( soft < -1 ) {
+                                       if ( lutil_atoi( &soft, arg ) != 0 || soft < -1 ) {
                                                return( 1 );
                                        }
 
@@ -677,14 +672,9 @@ limits_parse_one(
                                        limit->lms_t_hard = -1;
 
                                } else {
-                                       char    *next = NULL;
-                                       int     hard = strtol( arg, &next, 10 );
-
-                                       if ( next == arg || next[ 0 ] != '\0' ) {
-                                               return( 1 );
-                                       }
+                                       int     hard;
 
-                                       if ( hard < -1 ) {
+                                       if ( lutil_atoi( &hard, arg ) != 0 || hard < -1 ) {
                                                return( 1 );
                                        }
 
@@ -709,10 +699,9 @@ limits_parse_one(
                                limit->lms_t_soft = -1;
 
                        } else {
-                               char    *next = NULL;
-
-                               limit->lms_t_soft = strtol( arg, &next, 10 );
-                               if ( next == arg || limit->lms_t_soft < -1 ) {
+                               if ( lutil_atoi( &limit->lms_t_soft, arg ) != 0 
+                                       || limit->lms_t_soft < -1 )
+                               {
                                        return( 1 );
                                }
                        }
@@ -733,14 +722,9 @@ limits_parse_one(
                                        limit->lms_s_soft = -1;
 
                                } else {
-                                       char    *next = NULL;
-                                       int     soft = strtol( arg, &next, 10 );
-
-                                       if ( next == arg || next[ 0 ] != '\0' ) {
-                                               return( 1 );
-                                       }
+                                       int     soft;
 
-                                       if ( soft < -1 ) {
+                                       if ( lutil_atoi( &soft, arg ) != 0 || soft < -1 ) {
                                                return( 1 );
                                        }
 
@@ -760,14 +744,9 @@ limits_parse_one(
                                        limit->lms_s_hard = -1;
 
                                } else {
-                                       char    *next = NULL;
-                                       int     hard = strtol( arg, &next, 10 );
-
-                                       if ( next == arg || next[ 0 ] != '\0' ) {
-                                               return( 1 );
-                                       }
+                                       int     hard;
 
-                                       if ( hard < -1 ) {
+                                       if ( lutil_atoi( &hard, arg ) != 0 || hard < -1 ) {
                                                return( 1 );
                                        }
 
@@ -791,14 +770,9 @@ limits_parse_one(
                                        limit->lms_s_unchecked = 0;
 
                                } else {
-                                       char    *next = NULL;
-                                       int     unchecked = strtol( arg, &next, 10 );
-
-                                       if ( next == arg || next[ 0 ] != '\0' ) {
-                                               return( 1 );
-                                       }
+                                       int     unchecked;
 
-                                       if ( unchecked < -1 ) {
+                                       if ( lutil_atoi( &unchecked, arg ) != 0 || unchecked < -1 ) {
                                                return( 1 );
                                        }
 
@@ -818,14 +792,9 @@ limits_parse_one(
                                        limit->lms_s_pr = -1;
 
                                } else {
-                                       char    *next = NULL;
-                                       int     pr = strtol( arg, &next, 10 );
-
-                                       if ( next == arg || next[ 0 ] != '\0' ) {
-                                               return( 1 );
-                                       }
+                                       int     pr;
 
-                                       if ( pr < -1 ) {
+                                       if ( lutil_atoi( &pr, arg ) != 0 || pr < -1 ) {
                                                return( 1 );
                                        }
 
@@ -849,15 +818,9 @@ limits_parse_one(
                                        limit->lms_s_pr_total = 0;
 
                                } else {
-                                       char    *next = NULL;
                                        int     total;
 
-                                       total = strtol( arg, &next, 10 );
-                                       if ( next == arg || next[ 0 ] != '\0' ) {
-                                               return( 1 );
-                                       }
-
-                                       if ( total < -1 ) {
+                                       if ( lutil_atoi( &total, arg ) != 0 || total < -1 ) {
                                                return( 1 );
                                        }
 
@@ -882,10 +845,9 @@ limits_parse_one(
                                limit->lms_s_soft = -1;
 
                        } else {
-                               char    *next = NULL;
-
-                               limit->lms_s_soft = strtol( arg, &next, 10 );
-                               if ( next == arg || limit->lms_s_soft < -1 ) {
+                               if ( lutil_atoi( &limit->lms_s_soft, arg ) != 0
+                                       || limit->lms_s_soft < -1 )
+                               {
                                        return( 1 );
                                }
                        }
@@ -1271,6 +1233,9 @@ limits_check( Operation *op, SlapReply *rs )
                                                return -1;
                                        }
                                        op->ors_slimit = slimit;
+
+                               } else if ( slimit == 0 ) {
+                                       op->ors_slimit = 0;
                                }
 
                        } else {