summaryrefslogtreecommitdiff
path: root/src/cmd/fix/egltype.go
blob: a096db6665a5fbe19ec5efb3ae7897ad5d8957cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

import (
	"go/ast"
)

func init() {
	register(eglFixDisplay)
	register(eglFixConfig)
}

var eglFixDisplay = fix{
	name:     "egl",
	date:     "2018-12-15",
	f:        eglfixDisp,
	desc:     `Fixes initializers of EGLDisplay`,
	disabled: false,
}

// Old state:
//
//	type EGLDisplay unsafe.Pointer
//
// New state:
//
//	type EGLDisplay uintptr
//
// This fix finds nils initializing these types and replaces the nils with 0s.
func eglfixDisp(f *ast.File) bool {
	return typefix(f, func(s string) bool {
		return s == "C.EGLDisplay"
	})
}

var eglFixConfig = fix{
	name:     "eglconf",
	date:     "2020-05-30",
	f:        eglfixConfig,
	desc:     `Fixes initializers of EGLConfig`,
	disabled: false,
}

// Old state:
//
//	type EGLConfig unsafe.Pointer
//
// New state:
//
//	type EGLConfig uintptr
//
// This fix finds nils initializing these types and replaces the nils with 0s.
func eglfixConfig(f *ast.File) bool {
	return typefix(f, func(s string) bool {
		return s == "C.EGLConfig"
	})
}