media/PRESUBMIT.py
def _CheckForNoV4L2AggregateInitialization(input_api, output_api):
  """Check that struct v4l2_* are not initialized as aggregates with a
  braced-init-list"""

  problems = []

  v4l2_aggregate_initializer_re = re.compile(r'(^|\W)struct.+v4l2_.+=.+{+}+;')

  for f in input_api.AffectedSourceFiles(_FilterFile):
    for line_number, line in f.ChangedContents():
      if v4l2_aggregate_initializer_re.search(line):
        problems.append('%s:%d' % (f, line_number))

  if problems:
    return [output_api.PresubmitPromptWarning(
      'Avoid initializing V4L2 structures with braced-init-lists, i.e. as '
      'aggregates. V4L2 structs often contain unions of various sized members: '
      'when a union is initialized by aggregate initialization, only the first '
      'non-static member is initialized, leaving other members unitialized if '
      'they are larger. Use memset instead.',
      problems)]
  return []
Check that struct v4l2_* are not initialized as aggregates with a
  braced-init-list
Check that struct v4l2_* are not initialized as aggregates with a
braced-init-list
Check that struct v4l2_ * are not initialized as aggregates with a braced - init - list
def _CheckForNoV4L2AggregateInitialization(input_api, output_api):
  problems = []
  v4l2_aggregate_initializer_re = re.compile(r'(^|\W)struct.+v4l2_.+=.+{+}+;')
  for f in input_api.AffectedSourceFiles(_FilterFile):
    for line_number, line in f.ChangedContents():
      if v4l2_aggregate_initializer_re.search(line):
        problems.append('%s:%d' % (f, line_number))
  if problems:
    return [output_api.PresubmitPromptWarning(
      'Avoid initializing V4L2 structures with braced-init-lists, i.e. as '
      'aggregates. V4L2 structs often contain unions of various sized members: '
      'when a union is initialized by aggregate initialization, only the first '
      'non-static member is initialized, leaving other members unitialized if '
      'they are larger. Use memset instead.',
      problems)]
  return []
def _CheckForNoV4L2AggregateInitialization ( input_api , output_api ) : problems = [ ] v4l2_aggregate_initializer_re = re . compile ( r'(^|\W)struct.+v4l2_.+=.+{+}+;' ) for f in input_api . AffectedSourceFiles ( _FilterFile ) : for line_number , line in f . ChangedContents ( ) : if v4l2_aggregate_initializer_re . search ( line ) : problems . append ( '%s:%d' % ( f , line_number ) ) if problems : return [ output_api . PresubmitPromptWarning ( 'Avoid initializing V4L2 structures with braced-init-lists, i.e. as ' 'aggregates. V4L2 structs often contain unions of various sized members: ' 'when a union is initialized by aggregate initialization, only the first ' 'non-static member is initialized, leaving other members unitialized if ' 'they are larger. Use memset instead.' , problems ) ] return [ ]
Check that struct v4l2_* are not initialized as aggregates with a
braced-init-list
Check that struct v4l2_ * are not initialized as aggregates with a braced - init - list
"""Check that struct v4l2_* are not initialized as aggregates with a
  braced-init-list"""
input_api
output_api