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  //
    26  //	type EGLDisplay unsafe.Pointer
    27  //
    28  // New state:
    29  //
    30  //	type EGLDisplay uintptr
    31  //
    32  // This fix finds nils initializing these types and replaces the nils with 0s.
    33  func eglfixDisp(f *ast.File) bool {
    34  	return typefix(f, func(s string) bool {
    35  		return s == "C.EGLDisplay"
    36  	})
    37  }
    38  
    39  var eglFixConfig = fix{
    40  	name:     "eglconf",
    41  	date:     "2020-05-30",
    42  	f:        eglfixConfig,
    43  	desc:     `Fixes initializers of EGLConfig`,
    44  	disabled: false,
    45  }
    46  
    47  // Old state:
    48  //
    49  //	type EGLConfig unsafe.Pointer
    50  //
    51  // New state:
    52  //
    53  //	type EGLConfig uintptr
    54  //
    55  // This fix finds nils initializing these types and replaces the nils with 0s.
    56  func eglfixConfig(f *ast.File) bool {
    57  	return typefix(f, func(s string) bool {
    58  		return s == "C.EGLConfig"
    59  	})
    60  }
    61  

View as plain text