@@ -1365,6 +1365,22 @@ data_from_funcptr (void (*funcptr) (void))
1365
1365
interchangeably, so it's OK to assume that here too. */
1366
1366
return (void const * ) funcptr ;
1367
1367
}
1368
+
1369
+ /* Print the value of the pointer PTR. */
1370
+
1371
+ static void
1372
+ print_pointer (Lisp_Object printcharfun , char * buf , const char * prefix ,
1373
+ const void * ptr )
1374
+ {
1375
+ uintptr_t ui = (uintptr_t ) ptr ;
1376
+
1377
+ /* In theory this assignment could lose info on pre-C99 hosts, but
1378
+ in practice it doesn't. */
1379
+ uintmax_t up = ui ;
1380
+
1381
+ int len = sprintf (buf , "%s 0x%" PRIxMAX , prefix , up );
1382
+ strout (buf , len , len , printcharfun );
1383
+ }
1368
1384
#endif
1369
1385
1370
1386
static bool
@@ -1803,33 +1819,15 @@ print_vectorlike (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag,
1803
1819
dynlib_addr (ptr , & file , & symbol );
1804
1820
1805
1821
if (symbol == NULL )
1806
- {
1807
- uintptr_t ui = (uintptr_t ) data_from_funcptr (ptr );
1808
-
1809
- /* In theory this assignment could lose info on pre-C99
1810
- hosts, but in practice it doesn't. */
1811
- uintmax_t up = ui ;
1812
-
1813
- int len = sprintf (buf , "at 0x%" PRIxMAX , up );
1814
- strout (buf , len , len , printcharfun );
1815
- }
1816
- else
1822
+ print_pointer (printcharfun , buf , "at" , data_from_funcptr (ptr ));
1823
+ else
1817
1824
print_c_string (symbol , printcharfun );
1818
1825
1819
1826
void * data = module_function_data (function );
1820
1827
if (data != NULL )
1821
- {
1822
- uintptr_t ui = (uintptr_t ) data ;
1823
-
1824
- /* In theory this assignment could lose info on pre-C99
1825
- hosts, but in practice it doesn't. */
1826
- uintmax_t up = ui ;
1827
-
1828
- int len = sprintf (buf , " with data 0x%" PRIxMAX , up );
1829
- strout (buf , len , len , printcharfun );
1830
- }
1828
+ print_pointer (printcharfun , buf , " with data" , data );
1831
1829
1832
- if (file != NULL )
1830
+ if (file != NULL )
1833
1831
{
1834
1832
print_c_string (" from " , printcharfun );
1835
1833
print_c_string (file , printcharfun );
0 commit comments