  In this paper, we give a method for constructing linear codes with small
hulls by generalizing the method in \cite{LCD-T-matric}. As a result, we obtain
many optimal Euclidean LCD codes and Hermitian LCD codes, which improve the
previously known lower bound on the largest minimum distance. We also obtain
many optimal codes with one-dimension hull. Furthermore, we give three tables
about formally self-dual LCD codes.
