On 26. 5. 26 18:09, [email protected] wrote:
Author: ivan
Date: Tue May 26 16:09:14 2026
New Revision: 1934646

Log:
Resolve compiler warning (C4312: 'type cast': conversion from 'unsigned int'
to 'void *' of greater size).

* subversion/libsvn_repos/rev_hunt.c
   (find_interesting_revisions): Use "1" instead of 0xdeadbeef as non-null
    pointer for hashtable.

Modified:
    subversion/trunk/subversion/libsvn_repos/rev_hunt.c

Modified: subversion/trunk/subversion/libsvn_repos/rev_hunt.c
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/rev_hunt.c Tue May 26 15:32:31 
2026        (r1934645)
+++ subversion/trunk/subversion/libsvn_repos/rev_hunt.c Tue May 26 16:09:14 
2026        (r1934646)
@@ -1198,7 +1198,7 @@ find_interesting_revisions(apr_array_hea
        svn_hash_sets(duplicate_path_revs,
                      apr_psprintf(result_pool, "%s:%ld", path_rev->path,
                                   path_rev->revnum),
-                    (void *)0xdeadbeef);
+                    "1");
if (path_rev->revnum <= start)
          break;

That dead beef was there because we're using the hash table as a set, not a dictionary; only the keys matter. It was intentionally an invalid pointer so that the code would crash in a very recognisable way (better than NULL) if someone ever tried to dereference the value from the hash table. If you're fixing some useless compiler warning – frankly, a promotion that doesn't lose data shouldn't warn at all, this is C, after all – then at least replace it with NULL instead of a valid pointer that could one day hide a real bug.

Yes, I understand that not everyone likes my approach to defence against incorrect code. :)

-- Brane

Reply via email to