mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Simplify loops to copy (#19569)
- Simplify two loops into `copy` statements.
This commit is contained in:
		@@ -32,9 +32,8 @@ func GetLogDescriptions() map[string]*LogDescription {
 | 
			
		||||
	descs := make(map[string]*LogDescription, len(logDescriptions))
 | 
			
		||||
	for k, v := range logDescriptions {
 | 
			
		||||
		subLogDescriptions := make([]SubLogDescription, len(v.SubLogDescriptions))
 | 
			
		||||
		for i, s := range v.SubLogDescriptions {
 | 
			
		||||
			subLogDescriptions[i] = s
 | 
			
		||||
		}
 | 
			
		||||
		copy(subLogDescriptions, v.SubLogDescriptions)
 | 
			
		||||
 | 
			
		||||
		descs[k] = &LogDescription{
 | 
			
		||||
			Name:               v.Name,
 | 
			
		||||
			SubLogDescriptions: subLogDescriptions,
 | 
			
		||||
 
 | 
			
		||||
@@ -76,9 +76,7 @@ func GetLanguages(ctx *context.APIContext) {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	resp := make(languageResponse, len(langs))
 | 
			
		||||
	for i, v := range langs {
 | 
			
		||||
		resp[i] = v
 | 
			
		||||
	}
 | 
			
		||||
	copy(resp, langs)
 | 
			
		||||
 | 
			
		||||
	ctx.JSON(http.StatusOK, resp)
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user