Print this page
Bump Apache dependency to Apache 2

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/print/libpapi-common/common/attribute.c
          +++ new/usr/src/lib/print/libpapi-common/common/attribute.c
↓ open down ↓ 12 lines elided ↑ open up ↑
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
       23 + * Copyright 2012 Nexenta Systems, Inc.  All rights reserved.
  23   24   * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  24   25   * Use is subject to license terms.
  25   26   *
  26   27   */
  27   28  
  28   29  /* $Id: attribute.c 157 2006-04-26 15:07:55Z ktou $ */
  29   30  
  30      -#pragma ident   "%Z%%M% %I%     %E% SMI"
  31      -
  32   31  /*LINTLIBRARY*/
  33   32  
  34   33  #include <stdio.h>
  35   34  #include <stdlib.h>
  36   35  #include <stdarg.h>
  37   36  #include <string.h>
  38   37  #include <ctype.h>
  39   38  #include <alloca.h>
  40   39  #include <papi.h>
  41   40  #include <regex.h>
↓ open down ↓ 154 lines elided ↑ open up ↑
 196  195                  default:        /* unknown type, fail to duplicate */
 197  196                          free(result);
 198  197                          result = NULL;
 199  198                  }
 200  199          }
 201  200  
 202  201          return (result);
 203  202  }
 204  203  
 205  204  static papi_attribute_t *
 206      -papiAttributeAlloc(char *name, papi_attribute_value_type_t type)
      205 +papiAttributeAlloc(const char *name, papi_attribute_value_type_t type)
 207  206  {
 208  207          papi_attribute_t *result = NULL;
 209  208  
 210  209          if ((result = calloc(1, sizeof (*result))) != NULL) {
 211  210                  result->name = strdup(name);
 212  211                  result->type = type;
 213  212          }
 214  213  
 215  214          return (result);
 216  215  }
↓ open down ↓ 14 lines elided ↑ open up ↑
 231  230                          return (PAPI_TEMPORARY_ERROR);
 232  231  
 233  232                  list_append(values, tmp);
 234  233          }
 235  234  
 236  235          return (PAPI_OK);
 237  236  }
 238  237  
 239  238  papi_status_t
 240  239  papiAttributeListAddValue(papi_attribute_t ***list, int flgs,
 241      -                char *name, papi_attribute_value_type_t type,
      240 +                const char *name, papi_attribute_value_type_t type,
 242  241                  papi_attribute_value_t *value)
 243  242  {
 244  243          papi_status_t result;
 245  244          int flags = flgs;
 246  245          papi_attribute_t *attribute = NULL;
 247  246          papi_attribute_value_t **values = NULL;
 248  247  
 249  248          if ((list == NULL) || (name == NULL))
 250  249                  return (PAPI_BAD_ARGUMENT);
 251  250  
↓ open down ↓ 59 lines elided ↑ open up ↑
 311  310                          char *name, int integer)
 312  311  {
 313  312          papi_attribute_value_t v;
 314  313  
 315  314          v.integer = integer;
 316  315          return (papiAttributeListAddValue(list, flags, name, PAPI_INTEGER, &v));
 317  316  }
 318  317  
 319  318  papi_status_t
 320  319  papiAttributeListAddBoolean(papi_attribute_t ***list, int flags,
 321      -                        char *name, char boolean)
      320 +                        const char *name, char boolean)
 322  321  {
 323  322          papi_attribute_value_t v;
 324  323  
 325  324          v.boolean = boolean;
 326  325          return (papiAttributeListAddValue(list, flags, name, PAPI_BOOLEAN, &v));
 327  326  }
 328  327  
 329  328  papi_status_t
 330  329  papiAttributeListAddRange(papi_attribute_t ***list, int flags,
 331  330                          char *name, int lower, int upper)
↓ open down ↓ 63 lines elided ↑ open up ↑
 395  394          if ((attribute = papiAttributeListFind(*list, name)) == NULL)
 396  395                  return (PAPI_NOT_FOUND);
 397  396  
 398  397          list_remove(list, attribute);
 399  398          papiAttributeFree(attribute);
 400  399  
 401  400          return (PAPI_OK);
 402  401  }
 403  402  
 404  403  papi_attribute_t *
 405      -papiAttributeListFind(papi_attribute_t **list, char *name)
      404 +papiAttributeListFind(papi_attribute_t **list, const char *name)
 406  405  {
 407  406          int i;
 408  407          if ((list == NULL) || (name == NULL))
 409  408                  return (NULL);
 410  409  
 411  410          for (i = 0; list[i] != NULL; i++)
 412  411                  if (strcasecmp(list[i]->name, name) == 0)
 413  412                          return ((papi_attribute_t *)list[i]);
 414  413  
 415  414          return (NULL);
↓ open down ↓ 704 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX