Print this page
patch fix-lint

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libdisasm/common/libdisasm.c
          +++ new/usr/src/lib/libdisasm/common/libdisasm.c
↓ open down ↓ 15 lines elided ↑ open up ↑
  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   23   * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
  25   25   * Copyright 2012 Joshua M. Clulow <josh@sysmgr.org>
       26 + * Copyright 2014 Nexenta Systems, Inc.  All rights reserved.
  26   27   */
  27   28  
  28   29  #include <libdisasm.h>
  29   30  #include <stdlib.h>
  30   31  #ifdef DIS_STANDALONE
  31   32  #include <mdb/mdb_modapi.h>
       33 +#define _MDB
       34 +#include <mdb/mdb_io.h>
       35 +#else
       36 +#include <stdio.h>
  32   37  #endif
  33   38  
  34   39  #include "libdisasm_impl.h"
  35   40  
  36   41  static int _dis_errno;
  37   42  
  38   43  /*
  39   44   * If we're building the standalone library, then we only want to
  40   45   * include support for disassembly of the native architecture.
  41   46   * The regular shared library should include support for all
↓ open down ↓ 165 lines elided ↑ open up ↑
 207  212  dis_max_instrlen(dis_handle_t *dhp)
 208  213  {
 209  214          return (dhp->dh_arch->da_max_instrlen(dhp));
 210  215  }
 211  216  
 212  217  int
 213  218  dis_instrlen(dis_handle_t *dhp, uint64_t pc)
 214  219  {
 215  220          return (dhp->dh_arch->da_instrlen(dhp, pc));
 216  221  }
      222 +
      223 +int
      224 +dis_vsnprintf(char *restrict s, size_t n, const char *restrict format,
      225 +    va_list args)
      226 +{
      227 +#ifdef DIS_STANDALONE
      228 +        return (mdb_iob_vsnprintf(s, n, format, args));
      229 +#else
      230 +        return (vsnprintf(s, n, format, args));
      231 +#endif
      232 +}
      233 +
      234 +int
      235 +dis_snprintf(char *restrict s, size_t n, const char *restrict format, ...)
      236 +{
      237 +        va_list args;
      238 +
      239 +        va_start(args, format);
      240 +        n = dis_vsnprintf(s, n, format, args);
      241 +        va_end(args);
      242 +
      243 +        return (n);
      244 +}
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX