Source file src/cmd/fix/egltype.go

     1  // Copyright 2018 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package main
     6  
     7  import (
     8  	"go/ast"
     9  )
    10  
    11  func init() {
    12  	register(eglFixDisplay)
    13  	register(eglFixConfig)
    14  }
    15  
    16  var eglFixDisplay = fix{
    17  	name:     "egl",
    18  	date:     "2018-12-15",
    19  	f:        eglfixDisp,
    20  	desc:     `Fixes initializers of EGLDisplay`,
    21  	disabled: false,
    22  }
    23  
    24  // Old state:
    25  //   type EGLDisplay unsafe.Pointer
    26  // New state:
    27  //   type EGLDisplay uintptr
    28  // This fix finds nils initializing these types and replaces the nils with 0s.
    29  func eglfixDisp(f *ast.File) bool {
    30  	return typefix(f, func(s string) bool {
    31  		return s == "C.EGLDisplay"
    32  	})
    33  }
    34  
    35  var eglFixConfig = fix{
    36  	name:     "eglconf",
    37  	date:     "2020-05-30",
    38  	f:        eglfixConfig,
    39  	desc:     `Fixes initializers of EGLConfig`,
    40  	disabled: false,
    41  }
    42  
    43  // Old state:
    44  //   type EGLConfig unsafe.Pointer
    45  // New state:
    46  //   type EGLConfig uintptr
    47  // This fix finds nils initializing these types and replaces the nils with 0s.
    48  func eglfixConfig(f *ast.File) bool {
    49  	return typefix(f, func(s string) bool {
    50  		return s == "C.EGLConfig"
    51  	})
    52  }
    53  

View as plain text