mirror of
https://github.com/golang/go
synced 2024-11-26 06:57:56 -07:00
runtime: use correct types for maxstring and concatstring
Updates #6046. This CL just does maxstring and concatstring. There are other functions to fix but doing them a few at a time will help isolate any (unlikely) breakages these changes bring up in architectures I can't test myself. R=golang-dev, dave, iant CC=golang-dev https://golang.org/cl/12519044
This commit is contained in:
parent
ad119b9c4d
commit
98a80b95b4
@ -350,8 +350,6 @@ runtime·printpointer(void *p)
|
|||||||
void
|
void
|
||||||
runtime·printstring(String v)
|
runtime·printstring(String v)
|
||||||
{
|
{
|
||||||
extern uint32 runtime·maxstring;
|
|
||||||
|
|
||||||
if(v.len > runtime·maxstring) {
|
if(v.len > runtime·maxstring) {
|
||||||
gwrite("[string too long]", 17);
|
gwrite("[string too long]", 17);
|
||||||
return;
|
return;
|
||||||
|
@ -706,7 +706,7 @@ extern int8* runtime·goos;
|
|||||||
extern int32 runtime·ncpu;
|
extern int32 runtime·ncpu;
|
||||||
extern bool runtime·iscgo;
|
extern bool runtime·iscgo;
|
||||||
extern void (*runtime·sysargs)(int32, uint8**);
|
extern void (*runtime·sysargs)(int32, uint8**);
|
||||||
extern uint32 runtime·maxstring;
|
extern uintptr runtime·maxstring;
|
||||||
extern uint32 runtime·Hchansize;
|
extern uint32 runtime·Hchansize;
|
||||||
extern uint32 runtime·cpuid_ecx;
|
extern uint32 runtime·cpuid_ecx;
|
||||||
extern uint32 runtime·cpuid_edx;
|
extern uint32 runtime·cpuid_edx;
|
||||||
|
@ -35,13 +35,13 @@ runtime·findnullw(uint16 *s)
|
|||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 runtime·maxstring = 256; // a hint for print
|
uintptr runtime·maxstring = 256; // a hint for print
|
||||||
|
|
||||||
static String
|
static String
|
||||||
gostringsize(intgo l)
|
gostringsize(intgo l)
|
||||||
{
|
{
|
||||||
String s;
|
String s;
|
||||||
uint32 ms;
|
uintptr ms;
|
||||||
|
|
||||||
if(l == 0)
|
if(l == 0)
|
||||||
return runtime·emptystring;
|
return runtime·emptystring;
|
||||||
@ -51,7 +51,7 @@ gostringsize(intgo l)
|
|||||||
s.str[l] = 0;
|
s.str[l] = 0;
|
||||||
for(;;) {
|
for(;;) {
|
||||||
ms = runtime·maxstring;
|
ms = runtime·maxstring;
|
||||||
if((uint32)l <= ms || runtime·cas(&runtime·maxstring, ms, (uint32)l))
|
if((uintptr)l <= ms || runtime·casp((void**)&runtime·maxstring, (void*)ms, (void*)l))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
@ -176,7 +176,7 @@ concatstring(intgo n, String *s)
|
|||||||
// not have a fixed size argument count.
|
// not have a fixed size argument count.
|
||||||
#pragma textflag 7
|
#pragma textflag 7
|
||||||
void
|
void
|
||||||
runtime·concatstring(int32 n, String s1, ...)
|
runtime·concatstring(intgo n, String s1, ...)
|
||||||
{
|
{
|
||||||
(&s1)[n] = concatstring(n, &s1);
|
(&s1)[n] = concatstring(n, &s1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user