]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Minor non-functional cleanups.
authorFlorian Krohm <florian@eich-krohm.de>
Fri, 14 Nov 2014 19:25:08 +0000 (19:25 +0000)
committerFlorian Krohm <florian@eich-krohm.de>
Fri, 14 Nov 2014 19:25:08 +0000 (19:25 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14723

coregrind/m_coredump/coredump-elf.c
coregrind/m_debuginfo/debuginfo.c
coregrind/m_errormgr.c
coregrind/m_libcfile.c
coregrind/m_machine.c
coregrind/m_syswrap/priv_syswrap-generic.h
coregrind/m_syswrap/syswrap-generic.c
coregrind/pub_core_libcfile.h

index 1f9ebed4a242b9cd793f9131b20db1b79e61b3f3..4990141b86c62f4d87c682b467cfb3f5d59cc5b8 100644 (file)
@@ -195,7 +195,7 @@ static void write_note(Int fd, const struct note *n)
 static void fill_prpsinfo(const ThreadState *tst,
                           struct vki_elf_prpsinfo *prpsinfo)
 {
-   HChar *name;
+   const HChar *name;
 
    VG_(memset)(prpsinfo, 0, sizeof(*prpsinfo));
 
@@ -223,7 +223,7 @@ static void fill_prpsinfo(const ThreadState *tst,
    prpsinfo->pr_gid = 0;
    
    if (VG_(resolve_filename)(VG_(cl_exec_fd), &name)) {
-      HChar *n = name+VG_(strlen)(name)-1;
+      const HChar *n = name + VG_(strlen)(name) - 1;
 
       while (n > name && *n != '/')
         n--;
index 217f1d1be923b9cbb03a50112a392f31c41afc8e..8df866d4927f1b12cbb09884f3de15db7a753544 100644 (file)
@@ -1227,7 +1227,7 @@ void VG_(di_notify_pdb_debuginfo)( Int fd_obj, Addr avma_obj,
    obj_mtime = stat_buf.mtime;
 
    /* and get its name into exename. */
-   HChar *exe;
+   const HChar *exe;
    if (! VG_(resolve_filename)(fd_obj, &exe))
       return; /*  failed */
    sz_exename = VG_(strlen)(exe);
index b00d9e77d8a28ddce6d8c8de35641b40b69f8bd1..6b59c8e38e5268c6d474947e9e2bd36cdaf59de0 100644 (file)
@@ -1106,18 +1106,18 @@ static Int get_char ( Int fd, HChar* out_buf )
    static HChar buf[256];
    static Int buf_size = 0;
    static Int buf_used = 0;
-   vg_assert(buf_size >= 0 && buf_size <= 256);
+   vg_assert(buf_size >= 0 && buf_size <= sizeof buf);
    vg_assert(buf_used >= 0 && buf_used <= buf_size);
    if (buf_used == buf_size) {
-      r = VG_(read)(fd, buf, 256);
+      r = VG_(read)(fd, buf, sizeof buf);
       if (r < 0) return r; /* read failed */
-      vg_assert(r >= 0 && r <= 256);
+      vg_assert(r >= 0 && r <= sizeof buf);
       buf_size = r;
       buf_used = 0;
    }
    if (buf_size == 0)
      return 0; /* eof */
-   vg_assert(buf_size >= 0 && buf_size <= 256);
+   vg_assert(buf_size >= 0 && buf_size <= sizeof buf);
    vg_assert(buf_used >= 0 && buf_used < buf_size);
    *out_buf = buf[buf_used];
    buf_used++;
index 71f454c9912b0e8b1ec2589b5de268cedcf573de..210d49b00d14a2510791f38dbc0aa28504012f1f 100644 (file)
@@ -76,7 +76,7 @@ Int VG_(safe_fd)(Int oldfd)
    filename will be overwritten with the next invocation so callers
    need to copy the filename if needed. *result is NULL if the filename
    cannot be deduced. */
-Bool VG_(resolve_filename) ( Int fd, HChar** result )
+Bool VG_(resolve_filename) ( Int fd, const HChar** result )
 {
 #  if defined(VGO_linux)
    static HChar *buf = NULL;
index 212673f8028d05983f632630c1773f66ef791824..de4c4148694ccde62c77c6043d9f193a645d478d 100644 (file)
@@ -537,7 +537,7 @@ static void find_ppc_dcbz_sz(VexArchInfo *arch_info)
 static UInt VG_(get_machine_model)(void)
 {
    static struct model_map {
-      HChar name[5];
+      const HChar name[5];
       UInt  id;
    } model_map[] = {
       { "2064", VEX_S390X_MODEL_Z900 },
@@ -1263,7 +1263,7 @@ Bool VG_(machine_get_hwcaps)( void )
                              ".short 0x0057" : : : "r0", "r1", "cc", "memory");
      }
 
-     /* Check availability og STFLE. If available store facility bits
+     /* Check availability of STFLE. If available store facility bits
         in hoststfle. */
      ULong hoststfle[S390_NUM_FACILITY_DW];
 
index b3372f3a5e1ab0ac237012d5a7c8f5f3a24f2936..f014914b3d90d671c7134006ee6f93c7ccce8dc9 100644 (file)
@@ -64,7 +64,7 @@ Bool ML_(fd_allowed)(Int fd, const HChar *syscallname, ThreadId tid,
 extern void ML_(record_fd_open_named)          (ThreadId tid, Int fd);
 extern void ML_(record_fd_open_nameless)       (ThreadId tid, Int fd);
 extern void ML_(record_fd_open_with_given_name)(ThreadId tid, Int fd,
-                                                char *pathname);
+                                                const HChar *pathname);
 
 // Used when killing threads -- we must not kill a thread if it's the thread
 // that would do Valgrind's final cleanup and output.
index 0e5d21229f2422c86f99256c5949cf5c900af58f..94450110233f2f241df05237f35a32a96fef2609 100644 (file)
@@ -585,7 +585,8 @@ void record_fd_close(Int fd)
    some such thing) or that we don't know the filename.  If the fd is
    already open, then we're probably doing a dup2() to an existing fd,
    so just overwrite the existing one. */
-void ML_(record_fd_open_with_given_name)(ThreadId tid, Int fd, char *pathname)
+void ML_(record_fd_open_with_given_name)(ThreadId tid, Int fd,
+                                         const HChar *pathname)
 {
    OpenFd *i;
 
@@ -621,8 +622,8 @@ void ML_(record_fd_open_with_given_name)(ThreadId tid, Int fd, char *pathname)
 // Record opening of an fd, and find its name.
 void ML_(record_fd_open_named)(ThreadId tid, Int fd)
 {
-   HChar* buf;
-   HChar* name;
+   const HChar* buf;
+   const HChar* name;
    if (VG_(resolve_filename)(fd, &buf))
       name = buf;
    else
index e59b3e03c55c4b46b2c59c705c382996a8db11b4..560e10ce55154256785b24557b9633abe9013285 100644 (file)
@@ -44,7 +44,7 @@ extern Int VG_(safe_fd) ( Int oldfd );
 extern Int VG_(fcntl)   ( Int fd, Int cmd, Addr arg );
 
 /* Convert an fd into a filename */
-extern Bool VG_(resolve_filename) ( Int fd, HChar** buf );
+extern Bool VG_(resolve_filename) ( Int fd, const HChar** buf );
 
 /* Return the size of a file, or -1 in case of error */
 extern Long VG_(fsize) ( Int fd );